1 条题解
-
0
把 1~x 的体系转换为 0~x-1 的体系
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; // 转换成 0 开头的体系 n--; // 算出来 0 开头时的年月日 // 相当于 ~ 3 120 的进制 int y = n / 360; int m = n / 120 % 3; int d = n % 120; // 输出 1 开头的体系 cout << y + 1 << " " << m + 1 << " " << d + 1; return 0; }
模拟一天天过
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int y, m, d; y = 1, m = 1, d = 1; for (int i = 1; i <= n - 1; i++) { d++; if (d > 120) m++, d = 1; if (m > 3) y++, m = 1; } cout << y << " " << m << " " << d; return 0; }
- 1
信息
- ID
- 1485
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 6
- 标签
- 递交数
- 22
- 已通过
- 12
- 上传者