2028 Lowest Common Multiple Plus
1 #include<stdio.h>
2
3 int gcd(int a,int b){
4 int temp,temp1;
5 if(a<b){
6 temp = a;
7 a = b;
8 b = temp;
9 }
10 while(a%b!=0){
11 temp1 = a%b;
12 a = b;
13 b = temp1;
14 }
15 return b;
16 }
17
18 int main(){
19 int n,s,i;
20 long long k;
21 while(scanf("%d",&n)!=EOF){
22 k=1;
23 for(i=0;i<n;i++){
24 scanf("%d",&s);
25 k = s*k/gcd(s,k);
26 }
27
28 printf("%lld
",k);
29 }
30 }
2034 人见人爱A-B
#include<stdio.h>
#include<string.h>
int main(){
int n,m,i,j,num,flag,temp,s[101],o[101],p[101];
while(~scanf("%d %d",&n,&m)){
if(n==0&&m==0){break;}
for(i=0;i<n;i++){scanf("%d",&s[i]);}
for(i=0;i<m;i++){scanf("%d",&o[i]);}
num = 0;
for(i=0;i<n;i++){
flag = 0;
for(j=0;j<m;j++){
if(s[i]==o[j]){flag=1;break;}
}
if(flag==0){p[num]=s[i];num++;}
}
if(num==0){printf("NULL
");continue;}
for(i=0;i<num;i++){
for(j=num-1;j>i;j--){
if(p[i]>p[j]){
temp = p[i];
p[i] = p[j];
p[j] = temp;
}
}
}
for(i=0;i<num;i++){
printf("%d ",p[i]);
}
printf("
");
}
}
2035 人见人爱A^B
1 #include<stdio.h>
2
3 int main(){
4 int n,m,i,mul;
5 while(scanf("%d %d",&n,&m)!=EOF){
6 if(n==0&&m==0){break;}
7 mul = 1;
8 for(i=0;i<m;i++){
9 mul = mul * n % 1000;
10 }
11 printf("%d
",mul);
12 }
13 }
2041 超级楼梯
1 #include<stdio.h>
2
3 int main(){
4 int n,m,i,s[100];
5 while(~scanf("%d",&n)){
6 while(n--){
7 scanf("%d",&m);
8 s[1]=0;s[2]=1;s[3]=2;
9 for(i=4;i<=m;i++){
10 s[i] = s[i-1] + s[i-2];
11 }
12 printf("%d
",s[m]);
13 }
14 }
15 }
2043 密码
1 #include<stdio.h>
2 #include<string.h>
3
4
5 int main(){
6 int n,len,i,j,flag1,flag2,flag3,flag4;
7 char s[50][50];
8 while(~scanf("%d",&n)){
9 getchar();
10 for(i=0;i<n;i++){
11 gets(s[i]);
12 len = strlen(s[i]);
13 flag1=0;flag2=0;
14 flag3=0;flag4=0;
15 if(8>len||len>16){
16 printf("NO
");
17 continue;
18 }
19 else{
20 for(j=0;s[i][j]!='