Submission #00029


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define st string
#define total(n) n*(n+1)/2
#define endl "\n"
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); ++i)
#define rrep(i, n) for(ll i = (n-1); i >= 0; i--)
#define spep(i,a,b) for(ll i=a;i<b;i++)
#define sppep(i,a) for(ll i=a;i >= 0;i--)
#define vpl vector<pair<ll,ll>>
#define all(A) A.begin(),A.end()
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define sp(n) cout<<std::fixed<<setprecision(13)<<n<<endl;
#define sz(x) (ll)(x).size()
#define MOD 998244353
#define pb push_back
#define po pop_back
#define fi first
#define se second
#define mod 998244353
#define lcm(a,b) (a * b) / __gcd(a,b)
void yn(bool a) { cout << (a ? "Yes" : "No") << endl; }
void YN(bool a) { cout << (a ? "YES" : "NO") << endl; }
const ll INF = 1LL << 60;
const int inf = 1 << 30;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int a[]={1868,1912,1926,1989};
char b[]={'M','T','S','H'};
int e,y;
cin>>e>>y;
if(e==0){
int i=upper_bound(a,a+4,y)-a-1;
cout<<b[i]<<y-a[i]+1<<endl;
}else{
cout<<a[e-1]+y-1<<endl;
}
return(0);
}

ステータス

項目 データ
問題 0004 - 日本の暦
ユーザー名 ei2124
投稿日時 2022-07-19 16:12:12
言語 C++17
状態 Accepted
得点 4
ソースコード長 1587 Byte
最大実行時間 39 ms
最大メモリ使用量 780 KB

セット

セット 得点 Cases
1 ALL 4 / 4 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in01.txt AC 39 ms 348 KB
1
in02.txt AC 18 ms 308 KB
1
in03.txt AC 31 ms 512 KB
1
in04.txt AC 23 ms 472 KB
1
in05.txt AC 23 ms 560 KB
1
in06.txt AC 22 ms 512 KB
1
in07.txt AC 26 ms 596 KB
1
in08.txt AC 25 ms 552 KB
1
in09.txt AC 22 ms 632 KB
1
in10.txt AC 22 ms 584 KB
1
in11.txt AC 21 ms 664 KB
1
in12.txt AC 25 ms 620 KB
1
in13.txt AC 30 ms 576 KB
1
in14.txt AC 25 ms 532 KB
1
in15.txt AC 18 ms 492 KB
1
in16.txt AC 35 ms 572 KB
1
in17.txt AC 17 ms 780 KB
1
in18.txt AC 23 ms 732 KB
1
in19.txt AC 16 ms 688 KB
1
in20.txt AC 23 ms 644 KB
1
in21.txt AC 20 ms 732 KB
1
in22.txt AC 23 ms 684 KB
1
in23.txt AC 23 ms 768 KB
1
in24.txt AC 23 ms 728 KB
1
in25.txt AC 27 ms 680 KB
1