C++ GESP 三级闯关 语言热身

B站影视 2025-01-10 04:20 2

摘要:#include using namespace std;int main { int n; cin >> n; int a = 0, b = 0; while(n--){ char x, y; cin >> x >> y; if

1细胞分裂

#include using namespace std;int main { cout

2幸运数

#include using namespace std;int main { int n, k; cin >> n >> k; cout

3奇偶分家

#include using namespace std;int main { int n; cin >> n; int a = 0, b = 0; while(n--){ int x; cin >> x; if(x & 1) a++; else b++; } cout

4石头剪子布

#include using namespace std;int main { int n; cin >> n; int a = 0, b = 0; while(n--){ char x, y; cin >> x >> y; if((x == 'S' && y == 'J') || (x == 'J' && y == 'B') || (x == 'B' && y == 'S') ) a++; else if(x == y) a++, b++; else b++; } if(a > b) puts("xiaoyan"); else if(a == b) puts("QAQ"); else puts("xiaoke"); return 0;}

5错误减法

题目分析

#include using namespace std;int main { int n, k; cin >> n >> k; while(k--){ if(n % 10) n--; else n /= 10; } cout

6鸡兔同笼

#include using namespace std;int main { int a; cin >> a; /* 2 * x + 4 * y = a a % 2 == 0 a % 4 == 0 a / 4 a / 2 a / 4 + 1 a / 2 0 0 */ if(a % 2 == 0){ if(a % 4 == 0) cout

7神奇装置

#include using namespace std;int main { int a, b, c, d; cin >> a >> b >> c >> d; if(a b && b > c && c > d) puts("Fish Diving"); else if(a == b && b == c && c == d) puts("Fish At Constant Depth"); else puts("No Fish"); return 0;}

来源:青青游戏控

相关推荐