#include<iostream>
using namespace std;
int main() {
int yyyy, mm;
cin >> yyyy >> mm;
switch (mm) {
case 1: case 3: case 5: case 7: case 8: case 10 : case 12:
cout << 31 << endl; break;
case 4: case 6: case 9: case 11:
cout << 30 << endl; break;
case 2:
if (!(yyyy % 400) || !(yyyy % 4) && (yyyy % 100))
cout << 29 << endl;
else
cout << 28 << endl;
break;
default: break;
}
return 0;
}
#include<iostream>
using namespace std;
int main() {
int t1, t2, maxtime = 8, maxday = 0;
cin >> t1 >> t2;
if (t1 + t2 > maxtime) maxtime = t1 + t2, maxday = 1;
cin >> t1 >> t2;
if (t1 + t2 > maxtime) maxtime = t1 + t2, maxday = 2;
cin >> t1 >> t2;
if (t1 + t2 > maxtime) maxtime = t1 + t2, maxday = 3;
cin >> t1 >> t2;
if (t1 + t2 > maxtime) maxtime = t1 + t2, maxday = 4;
cin >> t1 >> t2;
if (t1 + t2 > maxtime) maxtime = t1 + t2, maxday = 5;
cin >> t1 >> t2;
if (t1 + t2 > maxtime) maxtime = t1 + t2, maxday = 6;
cin >> t1 >> t2;
if (t1 + t2 > maxtime) maxtime = t1 + t2, maxday = 7;
cout << maxday << endl;
return 0;
}
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int n, p1, p2, p3, t1, t2, t3, total; float n1, n2, n3;
cin >> n >> n1 >> n2 >> n3 >> p1 >> p2 >> p3;
t1 = ceil(n / n1) * p1;
t2 = ceil(n / n2) * p2;
t3 = ceil(n / n3) * p3;
total = t1;
if (t2 < total) total = t2;
if (t3 < total) total = t3;
cout << total << endl;
return 0;
}
#include<iostream>
using namespace std;
int main() {
int L, i; cin >> L;
for (i = 1; i <= L; i++) {
cout << "Today I ate " << i << " apple";
if (i != 1) cout << 's';
cout << "." << endl;
}
return 0;
}
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
int n, max_, tmp;
cin >> n;
cin >> max_;
for (int i = 1; i < n; i++) {
cin >> tmp;
tmp = max(tmp, max_);
}
cout << max_ << endl;
return 0;
}
#include<cstdio>
using namespace std;
int main() {
int n, k, A_sum = 0, B_sum = 0;
scanf("%d%d", &n, &k);
for (int i = k; i <= n; i += k)
A_sum += i;
B_sum = (1 + n) * n / 2 - A_sum;
printf("%.1f ", double(A_sum) / (n / k));
printf("%.1f", double(B_sum) / (n - n / k));
return 0;
}
C++入门同步记录#7
最新推荐文章于 2024-04-25 01:00:00 发布