Skip to content

Commit 4abb473

Browse files
committed
add niuke noob code tk2
1 parent 66511ef commit 4abb473

13 files changed

Lines changed: 218 additions & 0 deletions

File tree

.vs/slnx.sqlite

0 Bytes
Binary file not shown.

niuke/practice/noob/noob17.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
int main() {
8+
ios::sync_with_stdio(false), cin.tie(0);
9+
cout << fixed << setprecision(0);
10+
int n;
11+
cin >> n;
12+
13+
cout << ll(n) * pow(2, 20 - 2);//注意pow对应的计算结果是double,输出采用的是科学计数法
14+
15+
return 0;
16+
}

niuke/practice/noob/noob18.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
int main() {
8+
ios::sync_with_stdio(false), cin.tie(0);
9+
10+
int a, b, c;
11+
cin >> a >> b >> c;
12+
int s, v;
13+
s = 2 * (a * b + c * b + a * c);
14+
v = a * b * c;
15+
cout << s << '\n';
16+
cout << v << '\n';
17+
18+
return 0;
19+
}

niuke/practice/noob/noob19.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
int main() {
8+
ios::sync_with_stdio(false), cin.tie(0);
9+
10+
int a, b, c;
11+
cin >> a >> b >> c;
12+
int s;
13+
s = a*0.2+0.3 * b +0.5* c;
14+
cout << s << '\n';
15+
16+
return 0;
17+
}

niuke/practice/noob/noob20.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
ll get_sum(int n) {
8+
if (n == 1)return 1;
9+
else return ll(n) * (n + 1) / 2;
10+
}
11+
12+
int main() {
13+
ios::sync_with_stdio(false), cin.tie(0);
14+
15+
int n;
16+
cin >> n;
17+
cout << get_sum(n) << '\n';
18+
19+
return 0;
20+
}

niuke/practice/noob/noob21.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
int main() {
8+
ios::sync_with_stdio(false), cin.tie(0);
9+
10+
int d;
11+
cin >> d;
12+
cout << d % 7 + 1;
13+
14+
return 0;
15+
}

niuke/practice/noob/noob22.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
bool is_leap_year(int n) {
8+
if (n % 400 == 0 || n % 4 == 0 && n % 100 != 0)return true;
9+
else return false;
10+
}
11+
12+
int main() {
13+
ios::sync_with_stdio(false), cin.tie(0);
14+
15+
int n;
16+
cin >> n;
17+
if (is_leap_year(n))cout << "yes\n";
18+
else cout << "no\n";
19+
20+
return 0;
21+
}

niuke/practice/noob/noob23.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
int main() {
8+
ios::sync_with_stdio(false), cin.tie(0);
9+
10+
int a, b;
11+
cin >> a >> b;
12+
if (a < b)cout << '<';
13+
else if (a == b)cout << '=';
14+
else cout << '>';
15+
16+
return 0;
17+
}

niuke/practice/noob/noob24.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
int collatz_func(int n) {
8+
if (n & 1)return 3 * n + 1;
9+
else return n / 2;
10+
}
11+
12+
int main() {
13+
ios::sync_with_stdio(false), cin.tie(0);
14+
15+
int n;
16+
cin >> n;
17+
cout << collatz_func(n) << '\n';
18+
19+
return 0;
20+
}

niuke/practice/noob/noob25.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
typedef long long ll;
6+
7+
bool is_niumei_number(int n) {
8+
if (!(n & 1) && n > 50)return true;
9+
return false;
10+
}
11+
12+
int main() {
13+
ios::sync_with_stdio(false), cin.tie(0);
14+
15+
int n;
16+
cin >> n;
17+
if (is_niumei_number(n))cout << "yes\n";
18+
else cout << "no\n";
19+
20+
return 0;
21+
}

0 commit comments

Comments
 (0)