腾讯笔试第一题求助
哪位大佬帮忙看下,腾讯笔试第一题,本地能过,提交ac百分之0.。。。
#include <stdio.h>
int f1(int x,int y)
{
int a,b,c,z;
a=x;
b=y;
while(y){
z=x%y;
x=y;
y=z;
}
c=a*b/x;
return c;
}
int main()
{
int i=0,p,q=1,r,s;
int n,m=0;
scanf("%d",&n);
for(i=1;i<=n;i++){
q=f1(i,q);
}
for(m=n+1;;m++){
p=n+1;
for(i=n+1;i<=m;i++){
p=f1(p,i);
q=f1(q,i);
if(p==q){
r=p;
s=q;
break;
}
}
if(r==s){
printf("%d\n",m);
break;
}
}
return 0;
}
#笔试题目##腾讯#
查看16道真题和解析
顺丰集团工作强度 262人发布