摘要:
地址:http://codeforces.com/contest/267/problem/A更相减损,也是求最大公约数的方法,本题求用了多少次减法用辗转相除也是可以的,相当于把每一步求余时的商相加担心很大的数相除会出问题,所以用long long 1 #include<stdio.h> 2 3 int n; 4 long long a,b; 5 6 int main() 7 { 8 long long i,t,ans; 9 scanf("%d",&n);10 for(i=0;i<n;i++)11 {12 ans=0;13 sc... 阅读全文
posted @ 2013-01-18 20:58
tjsuhst
阅读(234)
评论(0)
推荐(0)
摘要:
地址:http://codeforces.com/contest/257/problem/A快排(一开始快排还写错了,死循环),然后就是比较所需插孔和已有插孔的个数了注意别忘了不需要排插的情况,此时答案为0 1 #include<stdio.h> 2 3 int n,m,k; 4 int f[50]; 5 6 int ones(int l,int r) 7 { 8 int i=l,j=r,flag=0,key=f[l]; 9 int t1;10 while(i<j)11 {12 if(0==flag)13 {14 ... 阅读全文
posted @ 2013-01-18 15:22
tjsuhst
阅读(185)
评论(0)
推荐(0)

浙公网安备 33010602011771号