5 条题解
-
3
这道题只需要使用三次
if
语句,依次判断能否整除这 个数,如果能就输出即可。#include<bits/stdc++.h> using namespace std; int main(){ int n,sum=0; cin>>n; if(n%3==0){ cout<<"3"<<" "; sum++; } if(n%5==0){ cout<<"5"<<" "; sum++; } if(n%7==0){ cout<<"7"<<" "; sum++; } if(sum==0) cout<<"n"<<endl; return 0; }
-
0
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 3 == 0 && n % 5 == 0 && n % 7 == 0) { cout << "3 5 7"; } else if (n % 3 == 0 and n % 5 == 0) { cout << "3 5"; } else if (n % 3 == 0 and n % 7 == 0) { cout << "3 7"; } else if (n % 5 == 0 and n % 7 == 0) { cout << "5 7"; } else if (n % 3 == 0) { cout << "3"; } else if (n % 5 == 0) { cout << "5"; } else if (n % 7 == 0) { cout << "7"; } else { cout << 'n'; } return 0; }
-
0
#include<iostream> #include<cstdio> #include<cmath> #include<algorithm> using namespace std; int main(){ int a; cin >> a; if (a%3 == 0 && a%5 == 0 && a%7 == 0){ cout << "3 5 7"; }else if (a%3 == 0 && a%5 == 0){ cout << "3 5"; }else if (a%3 == 0 && a%7 == 0){ cout << "3 7"; }else if (a%5 == 0 && a%7 == 0){ cout << "5 7"; }else if (a%3 == 0){ cout << "3"; }else if (a%5 == 0){ cout << "5"; }else if (a%7 == 0){ cout << "7"; }else{ cout << "n"; } return 0; }
-
0
#include<bits/stdc++.h> using namespace std; long long q,w,e,r,t,y,u,i,o,p,d,f,g,h,j,k,l,z,x,c,v,b,n,m; string s; long long a[100000],as[100000],asd[100000]; char cc; double dd; int main() { cin>>x; if(x%3==0) cout<<"3 "; if(x%5==0) cout<<"5 "; if(x%7==0) cout<<"7 "; if(x%3!=0&&x%5!=0&&x%7!=0) cout<<"n"; return 0; }
- 1
信息
- ID
- 6855
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 1
- 标签
- (无)
- 递交数
- 54
- 已通过
- 42
- 上传者