[ZJ]a215: 明明愛數數
題目:
http://zerojudge.tw/ShowProblem?problemid=a215
-----------------------------------------------------------------------------------------------
#include<cstdio>
int main()
{
int a, b;
while(scanf("%d%d",&a,&b)!=EOF)
{
int ans = 1;
for(int i=0;i+a<=b;i++)
ans++,b -= (a + i);
printf("%d\n",ans);
}
return 0;
}
http://zerojudge.tw/ShowProblem?problemid=a215
-----------------------------------------------------------------------------------------------
#include<cstdio>
int main()
{
int a, b;
while(scanf("%d%d",&a,&b)!=EOF)
{
int ans = 1;
for(int i=0;i+a<=b;i++)
ans++,b -= (a + i);
printf("%d\n",ans);
}
return 0;
}
留言
張貼留言