This commit is contained in:
HuangHai
2025-08-30 18:35:01 +08:00
commit 1f397eca87
6258 changed files with 1487241 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
printf("%d", a * b);
return 0;
}

View File

@@ -0,0 +1,12 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n <= 20) printf("%d", n * 10);
else
printf("%d", 20 * 10 + (n - 20) * 15);
return 0;
}

View File

@@ -0,0 +1,23 @@
#include <bits/stdc++.h>
using namespace std;
//判断一个数是不是质数
bool isPrime(int n) {
if (n < 2) return false;
for (int i = 2; i <= n / i; i++)
if (n % i == 0) return false;
return true;
}
int ans;
int main() {
int n;
cin >> n;
for (int i = 7; i <= n; i++)
if (i % 10 == 7 && isPrime(i)) ans++;
cout << ans << endl;
return 0;
}

View File

@@ -0,0 +1,66 @@
#include <bits/stdc++.h>
using namespace std;
//24点
int main() {
int a, b, c, d;
cin >> a >> b >> c >> d;
int res = 0, x;
x = a + b + c + d;
if (x == 24) res++;
x = a + b + c - d;
if (x == 24) res++;
x = a + b + c * d;
if (x == 24) res++;
x = a + b - c + d;
if (x == 24) res++;
x = a + b - c - d;
if (x == 24) res++;
x = a + b - c * d;
if (x == 24) res++;
x = a + b * c + d;
if (x == 24) res++;
x = a + b * c - d;
if (x == 24) res++;
x = a + b * c * d;
if (x == 24) res++;
x = a - b + c + d;
if (x == 24) res++;
x = a - b + c - d;
if (x == 24) res++;
x = a - b + c * d;
if (x == 24) res++;
x = a - b - c + d;
if (x == 24) res++;
x = a - b - c - d;
if (x == 24) res++;
x = a - b - c * d;
if (x == 24) res++;
x = a - b * c + d;
if (x == 24) res++;
x = a - b * c - d;
if (x == 24) res++;
x = a - b * c * d;
if (x == 24) res++;
x = a * b + c + d;
if (x == 24) res++;
x = a * b + c - d;
if (x == 24) res++;
x = a * b + c * d;
if (x == 24) res++;
x = a * b - c + d;
if (x == 24) res++;
x = a * b - c - d;
if (x == 24) res++;
x = a * b - c * d;
if (x == 24) res++;
x = a * b * c + d;
if (x == 24) res++;
x = a * b * c - d;
if (x == 24) res++;
x = a * b * c * d;
if (x == 24) res++;
cout << res;
return 0;
}

View File

@@ -0,0 +1,39 @@
#include <iostream>
using namespace std;
int days, y1, y2, m1, m2, d1, d2;
const int N = 13;
int months_1[N] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int months_2[N] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool LeapYear(int year) {
return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}
int main() {
cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
//2000.2.3--- 2009.8.9
// [2001,2002,2003,2004,2005,2006,2007,2008]
//y1+1--->y2-1
for (int i = y1 + 1; i <= y2 - 1; i++) {
if (LeapYear(i))days += 366;
else days += 365;
}
//y2
for (int i = 1; i <= m2 - 1; i++)
if (LeapYear(y2)) days += months_2[i];
else days += months_1[i];
days += d2;
//y1
int d0 = 0;
for (int i = 1; i <= m1 - 1; i++)
if (LeapYear(y1)) d0 += months_2[i];
else d0 += months_1[i];
d0 += d1 - 1;
if (LeapYear(y1))days += 366 - d0;
else days += 365 - d0;
//输出
cout << days - 1 << endl;
return 0;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB