1 条题解
-
0
C :
#include<stdio.h> int main() { int i=1; while(!((i%2==1)&&(i%3==2)&&(i%5==4)&&(i%6==5)&&(i%7==0))) ++i; printf("%d\n",i); return 0; }
C++ :
#include<iostream> #include<iomanip> #include<math.h> #include<bits/stdc++.h> using namespace std; int main(){ int i; for(i = 1;i <= 999999;i++) { if(i % 2 == 1){ if(i % 3 == 2){ if(i % 5 == 4){ if(i % 6 == 5){ if(i % 7 == 0){ cout<<i<<endl; break; } } } } } } return 0; }
Pascal :
var i:longint; begin for i:=1 to 1000000 do if (i mod 2=1) and (i mod 3=2) and (i mod 5=4) and (i mod 6=5) and (i mod 7=0) then begin write(i);break;end; end.
Java :
public class Main { public static void main(String[] args) { int g = 0; int s = 0; int b = 0; int q = 0; int a = 0; for(int i = 10; ; i++) { g = i % 2; s = i % 3; b = i % 5; q = i % 6; a = i % 7; if(g == 1 & s == 2 & b == 4 & q == 5 & a == 0 ) { System.out.println(i); break; } } } }
Python :
i=1 while i>=1: if i%2==1 and i%3==2 and i%5==4 and i%6==5 and i%7==0: print(i) break i+=1
- 1
信息
- ID
- 1521
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者