Skip to content

Commit 73510e3

Browse files
tkzzzzzz6Copilot
andcommitted
feat: 添加实现四舍五入的C++算法
Co-authored-by: Copilot <copilot@github.com>
1 parent 4d1433b commit 73510e3

9 files changed

Lines changed: 227 additions & 0 deletions
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* @Author: tkzzzzzz6
3+
* @Date: 2026-04-28 22:44:10
4+
* @LastEditors: tkzzzzzz6
5+
* @LastEditTime: 2026-04-28 22:44:16
6+
*/
7+
/**
8+
* @nc app=nowcoder id=f334a81b22654efc8d7a67e31f60de50 topic=383 question=11211642 lang=C++
9+
* 2026-04-28 22:44:10
10+
* https://www.nowcoder.com/practice/f334a81b22654efc8d7a67e31f60de50?tpId=383&tqId=11211642
11+
* [noob97] 参议院投票
12+
*/
13+
14+
/** @nc code=start */
15+
16+
class Solution {
17+
public:
18+
/**
19+
* 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
20+
*
21+
* 求出最终获胜帮派的名称
22+
* @param s string字符串
23+
* @return string字符串
24+
*/
25+
string predictVictory(string s) {
26+
// write code here
27+
28+
}
29+
};
30+
31+
/** @nc code=end */
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* @nc app=nowcoder id=741a9b79fabe474cb153a49b4bff5828 topic=225 question=2180560 lang=C++
3+
* 2026-05-04 16:28:11
4+
* https://www.nowcoder.com/practice/741a9b79fabe474cb153a49b4bff5828?tpId=225&tqId=2180560
5+
* [CPP11] 判断季节
6+
*/
7+
8+
/** @nc code=start */
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
15+
int month;
16+
cin >> month;
17+
18+
// write your code here......
19+
switch(month){
20+
case 3:case 4:case 5:
21+
cout << "春季" << endl;
22+
break;
23+
case 6:case 7:case 8:
24+
cout << "夏季" << endl;
25+
break;
26+
case 9:case 10:case 11:
27+
cout << "秋季" << endl;
28+
break;
29+
case 12:case 1:case 2:
30+
cout << "冬季" << endl;
31+
break;
32+
default:
33+
cout << "不合法" << endl;
34+
break;
35+
}
36+
37+
return 0;
38+
}
39+
40+
/** @nc code=end */
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* @nc app=nowcoder id=f1b704af4f654be285552bea53ce6534 topic=225 question=2179352 lang=C++
3+
* 2026-05-04 16:24:21
4+
* https://www.nowcoder.com/practice/f1b704af4f654be285552bea53ce6534?tpId=225&tqId=2179352
5+
* [CPP3] 两数求和
6+
*/
7+
8+
/** @nc code=start */
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
15+
// write your code here......
16+
int a,b;
17+
cin >> a >> b;
18+
cout << a + b <<endl;
19+
20+
return 0;
21+
}
22+
23+
/** @nc code=end */
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @nc app=nowcoder id=136bd5e1021d4d698b9f5227d7dfb684 topic=225 question=2179405 lang=C++
3+
* 2026-05-04 16:24:53
4+
* https://www.nowcoder.com/practice/136bd5e1021d4d698b9f5227d7dfb684?tpId=225&tqId=2179405
5+
* [CPP4] 获取两数中的较大值
6+
*/
7+
8+
/** @nc code=start */
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
15+
// write your code here......
16+
17+
18+
return 0;
19+
}
20+
21+
/** @nc code=end */
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* @nc app=nowcoder id=d7d48b7b44df46889137ec19d924bb14 topic=225 question=2180072 lang=C++
3+
* 2026-05-04 16:25:05
4+
* https://www.nowcoder.com/practice/d7d48b7b44df46889137ec19d924bb14?tpId=225&tqId=2180072
5+
* [CPP7] 获取三个数中的最大值(三元表达式实现)
6+
*/
7+
8+
/** @nc code=start */
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
15+
int a, b, c;
16+
cin >> a;
17+
cin >> b;
18+
cin >> c;
19+
20+
// write your code here......
21+
cout << ((a > b) ? ((a > c) ? a : c) : ((b>c)?b:c));
22+
23+
return 0;
24+
}
25+
26+
/** @nc code=end */
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* @Author: tkzzzzzz6
3+
* @Date: 2026-05-04 16:37:40
4+
* @LastEditors: tkzzzzzz6
5+
* @LastEditTime: 2026-05-06 22:36:29
6+
*/
7+
/**
8+
* @nc app=nowcoder id=9a2d212d23f5436c80607d5e68c6d12a topic=291 question=2185204 lang=C++
9+
* 2026-05-04 16:37:40
10+
* https://www.nowcoder.com/practice/9a2d212d23f5436c80607d5e68c6d12a?tpId=291&tqId=2185204
11+
* [CC1] 获取字符串长度
12+
*/
13+
14+
/** @nc code=start */
15+
16+
17+
#include <stdio.h>
18+
19+
int main() {
20+
21+
char buf[100] = {};
22+
if(fgets(buf,sizeof(buf),stdin) == nullptr)return 0;
23+
24+
char* p = buf;
25+
int len = 0;
26+
while (*p != '\0' && *p != '\n') {
27+
len++;
28+
p++;
29+
}
30+
31+
printf("%d", len);
32+
return 0;
33+
}
34+
35+
/** @nc code=end */
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/**
2+
* @nc app=nowcoder id=8f5b923683b94e549880e3c8370e3e55 topic=291 question=2185436 lang=C
3+
* 2026-05-06 22:48:30
4+
* https://www.nowcoder.com/practice/8f5b923683b94e549880e3c8370e3e55?tpId=291&tqId=2185436
5+
* [CC2] 复制部分字符串
6+
*/
7+
8+
/** @nc code=start */
9+
10+
#include <stdio.h>
11+
#include <string.h>
12+
13+
int main() {
14+
15+
string str1
16+
17+
18+
return 0;
19+
}
20+
21+
/** @nc code=end */
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* @nc app=nowcoder id=8f5b923683b94e549880e3c8370e3e55 topic=291 question=2185436 lang=C++
3+
* 2026-05-06 22:43:49
4+
* https://www.nowcoder.com/practice/8f5b923683b94e549880e3c8370e3e55?tpId=291&tqId=2185436
5+
* [CC2] 复制部分字符串
6+
*/
7+
8+
/** @nc code=start */
9+
10+
#include <iostream>
11+
using namespace std;
12+
13+
int main() {
14+
15+
char str[30] = { 0 };
16+
cin.getline(str, sizeof(str));
17+
18+
int m;
19+
cin >> m;
20+
21+
// write your code here......
22+
23+
24+
return 0;
25+
}
26+
27+
/** @nc code=end */
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 指针
2+
3+

0 commit comments

Comments
 (0)