| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
我菜鳥時在UVA水過的code!我自己再看也不明白了!#include<stdio.h>
int main(){
long long l,h,d,sum;
int k,i=1,j=1;
scanf("%d", &k);
while(k--){
sum = 0;
scanf("%lld %lld", &l, &h);
d = h-l;
for(i=1,j=1; sum<d ;j++){
sum+=i;
if(j%2==0) i++;
}
printf("%d\n", j-1);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator