摘要: #include<stdio.h>int main(){int a,b,a1,b1,b0,n,i;scanf("%d",&n);for(i=0;i<n;i++){ int s=0; scanf("%d%d",&a,&b); b0=b;while(a){a1=a%10;a/=10;b=b0;while(b){b1=b%10;b/=10;s=s+a1*b1;}}printf("%d\n",s);}return 0;} 阅读全文
posted @ 2013-06-16 16:25 融雪残阳 阅读(245) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>int main(){ int N,m,n,sum; scanf("%d",&N); while(N--) { sum = 0; scanf("%d%d",&m,&n); while(m) { sum = sum + m/n; m = m/n; } printf("%d\n",sum); } return 0;}5 阅读全文
posted @ 2013-06-16 15:48 融雪残阳 阅读(1705) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<math.h>int main(){ int i,j,s,M,N,a[1000]; float k; scanf("%d",&M); while(M--) { scanf("%d",&N); for(i=s=0;i<N;i++) { scanf("%d",&a[i]); k=sqrt(a[i]); for(j=2;j<=k;j++) if(a[i]%j==0) break; if(!(j<=k||a[i]==1||a[ 阅读全文
posted @ 2013-06-16 15:28 融雪残阳 阅读(1264) 评论(0) 推荐(1) 编辑
摘要: #include <stdio.h>int main(){int x,y,i,n,m,p;scanf("%d",&n);for(i=0;i<n;i++){scanf("%d%d",&x,&y);p=x*y;while(y!=0){ m=x%y;x=y;y=m;}printf("%d %d\n",x,p/x);}return 0;} 阅读全文
posted @ 2013-06-16 14:22 融雪残阳 阅读(2486) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int main(){int M,X,Y,Z,n;scanf("%d",&n);while(n--){scanf("%d%d%d%d",&M,&X,&Y,&Z);printf("%.2f\n",Z*((float)(M*X)/(Y-X)));}return 0;} 阅读全文
posted @ 2013-06-16 13:42 融雪残阳 阅读(716) 评论(0) 推荐(0) 编辑