9月16新浪管培生笔试
9月16日新浪产品管培生的编程题两道都50%。
有同学AC了吗???
下面是第一题的代码:大神帮我看看我哪里错了?
#新浪##管培生##笔试题目#
#include <iostream>
#include <vector>
using namespace std;
int main(){
int x,y,z;
cin>>x>>y>>z;
if(x < 0 || y < 0|| z<0|| x>=3||y>=5||z>=7)
{
cout<<"fail";
}
long num = 0;
long i = 0;
bool fail = true;
while(i < 10000000000)
{
num = 3*i + x;
if(num%5==y && num%7==z)
{
fail = false;
break;
}
i++;
}
if(fail)
{
cout<<"fail";
}else{
cout<<num;
}
return 0;
}