OJ-Problems-Source/OpenJudge/ch0201_冰封/1749.cpp

39 lines
782 B
C++
Raw Normal View History

2016-07-06 14:15:22 +08:00
#include<stdio.h>
#include<stdlib.h>
long stupid[50000];
int main(void){
int total;
scanf("%d",&total);
for(long fuck = 0; fuck < total; fuck++){
long n;
scanf("%d",&n);
if( n == 0 ){
stupid[fuck] = 0;
continue;
}
bool jjfly = true,dick = true;
long a,b,c;
for( b = n; b > 0 && dick; b--){
for( a = n; a > 0 && jjfly; a--){
if ((a + b) % 2 == 0){
for( c = n; c > 0; c--){
if(((b + c) %3 == 0) &&
((a + b + c) % 5 == 0)){
stupid[fuck] = a + b + c;
// printf("a = %d, b = %d, c = %d\n",a,b,c);
jjfly = false;
dick = false;
break;
}
}
}
}
}
for(long i = 0; i < total; i++){
printf("%d\n",stupid[i]);
}
// system("pause");
return 0;
}
}