68分

B2043 判断能否被 3,5,7 整除

? 发代码我看看
by NEKO_Daze @ 2024-08-08 14:12:59


@[lihaoming123](/user/1414203) ##### (AC,求关注) ``` #include<bits/stdc++.h> using namespace std; int main(){ int x; bool f=0; cin>>x; if(x%3==0){ cout<<3<<" "; f=1; } if(x%5==0){ cout<<5<<" "; f=1; } if(x%7==0){ cout<<7<<" "; f=1; } if(f==0)cout<<"n"; return 0; } ```
by haimingbei @ 2024-08-08 14:23:37


@[lihaoming123](/user/1414203) 代码 ```cpp #include <iostream> // eht begin fo thing yna... again dna niaga #include <string> #include <numeric> #include <algorithm> #include <vector> #include <cmath> #include <cctype> #include <cassert> #include <functional> #include <sstream> #include <cstdio> #include <cstdlib> #include <cstring> #include <climits> #pragma warning(disable : 4996) using namespace std; int main() { int x; scanf("%d", &x); bool d = 0; if (!(x % 3)) printf("3 "), d=1; if (!(x % 5)) printf("5 "), d=1; if (!(x % 7)) printf("7 "), d=1; if (!d) puts("n"); } ``` 不用谢,AC ~~(我这头文件多一点怎么还不然我发?)~~
by wanghaorui2012 @ 2024-08-12 14:23:24


@[haimingbei](/user/1235026) 你有刷水题!
by youthiscoming @ 2024-08-20 09:45:33


```cpp #include<bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if(n % 3 == 0) { cout << "3" << " "; } if(n % 5 == 0) { cout << "5" << " "; } if(n % 7 == 0) { cout << "7" << " "; } if(n % 3 != 0&&n % 5 != 0&&n % 7 != 0) { cout << "n"; } return 0; }
by Jason101 @ 2024-08-20 18:31:16


|