牛客7777779号
牛客7777779号
全部文章
分类
归档
标签
去牛客网
登录
/
注册
牛客7777779号的博客
全部文章
(共86篇)
题解 | #求最大最小数#
#include <algorithm> #include <iostream> using namespace std; int main() { int n; int max, min; while (cin >> n) { // 注...
2023-02-09
0
133
题解 | #Fibonacci#
#include <iostream> using namespace std; int Fibonacci(int n){ if (n == 0) return 0; if (n == 1) return 1; return Fibonacci(n-1)+ F...
2023-02-08
0
179
题解 | #反序输出#
之前上机都用C,后来发现C++有很多函数很方便,果断转C++这个题就用到了reverse翻转函数,只需要指明需要翻转的范围即可。 #include <algorithm> #include <iostream> using namespace std; #include<...
2023-02-08
0
157
题解 | #吃糖果#
用递归实现。巧克力情况可以看成当天吃2块或者当天吃1块两种。递归退出条件是巧克力个数n位0或1的时候,即(2,0)或(1,1)两种情况,此时函数返回值为1。 #include <iostream> using namespace std; int ans(int n){ //计算方案数...
2023-02-08
0
242
题解 | #反序输出#
#include <algorithm> #include <iostream> using namespace std; #include<string> int main() { string str; while (cin >>...
2023-02-08
0
177
题解 | #数字求和#
#include <iostream> using namespace std; int main() { int a,b; int sum = 0; while (cin >> a) { // 注意 while 处理多个 case ...
2023-02-07
0
175
题解 | #继续xxx定律#
遍历数组每个数的xxx定律,若数组中存在覆盖数,则将其置0,遍历完成数组后,数组中的非0数即为关键数,逆向输出即可。 #include <iostream> using namespace std; void key(int *a, int n){ for (int i = 0...
2023-02-07
0
254
题解 | #百万富翁问题#
注意审题,百万富翁是每天都给陌生人10万,且“百万富翁交出去的钱”不包括陌生人每天返给百万富翁的钱。 #include <iostream> using namespace std; #define richer 10 int main() { int stranger = 0...
2023-02-07
0
228
题解 | #反序数#
循环不需要写到9999,因为i*9要小于等于9999,所以循环到1111即可。暴力解: #include <iostream> using namespace std; int main() { int a, b, c, d; int temp; int aa,...
2023-02-07
0
225
题解 | #找x#
#include<iostream> using namespace std; int main(){ int n; int x; int i; while (cin >> n){ int a[n]; for ...
2023-02-05
0
255
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页