QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#420044 | #2826. 历史行程 | 300_205_205# | AC ✓ | 5ms | 13144kb | C++20 | 1.6kb | 2024-05-24 14:16:03 | 2024-05-24 14:16:04 |
Judging History
answer
//#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define N 200005
#define mod 998244353
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define ls (rt<<1)
#define rs ((rt<<1)|1)
#define fi first
#define se second
#define INF 1e9
#define rep(i,l,r) for(int i=(l);i<=(r);i++)
int qpow(int a,int b){
int res=1;
for(;b;b>>=1){
if(b&1) res=res*a%mod;
a=a*a%mod;
}
return res;
}
/*int fac[N],ifac[N];
int C(int n,int m){
if(m>n||m<0||n<0) return 0;
return fac[n]*ifac[n-m]%mod*ifac[m]%mod;
}
void init(){
fac[0]=1;
for(int i=1;i<N;i++) fac[i]=fac[i-1]*i%mod;
ifac[N-1]=qpow(fac[N-1],mod-2);
for(int i=N-2;i>=0;i--) ifac[i]=ifac[i+1]*(i+1)%mod;
}*/
inline int lowbit(int x){return x&(-x);}
inline int read(){
int x=0,t=1;char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-') t=-1;
ch=getchar();
}
while(ch>='0'&&ch<='9'){
x=(x<<1)+(x<<3)+(ch-'0');
ch=getchar();
}
return x*t;
}
inline void write(int x){
if(x<0) putchar('-'),x=-x;
if(x>=10) write(x/10);
putchar(x%10+'0');
}
int T,n,a=2019,b=5,c=12;
set<int>se[N];
int mo[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
signed main(){
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
int now=0;
while(a>=1913){
if(now%7==0&&b==5) se[a].insert(c);
now++;c--;
if(c==0){
b--;
if(b==0){
a--;
b=12;c=mo[12];
}else{
if(b==2){
if(a%4==0) c=29;
else c=28;
}
else c=mo[b];
}
}
}
int x;cin>>x;
auto it=se[x].begin();it++;
cout<<(*it)<<endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 12956kb
input:
1913
output:
11
result:
ok single line: '11'
Test #2:
score: 0
Accepted
time: 2ms
memory: 13116kb
input:
1914
output:
10
result:
ok single line: '10'
Test #3:
score: 0
Accepted
time: 5ms
memory: 13060kb
input:
1915
output:
9
result:
ok single line: '9'
Test #4:
score: 0
Accepted
time: 0ms
memory: 13128kb
input:
1916
output:
14
result:
ok single line: '14'
Test #5:
score: 0
Accepted
time: 0ms
memory: 13144kb
input:
1917
output:
13
result:
ok single line: '13'
Test #6:
score: 0
Accepted
time: 0ms
memory: 13116kb
input:
1918
output:
12
result:
ok single line: '12'
Test #7:
score: 0
Accepted
time: 0ms
memory: 13128kb
input:
1919
output:
11
result:
ok single line: '11'
Test #8:
score: 0
Accepted
time: 0ms
memory: 13000kb
input:
1920
output:
9
result:
ok single line: '9'
Test #9:
score: 0
Accepted
time: 0ms
memory: 13080kb
input:
1921
output:
8
result:
ok single line: '8'
Test #10:
score: 0
Accepted
time: 0ms
memory: 13112kb
input:
1922
output:
14
result:
ok single line: '14'
Test #11:
score: 0
Accepted
time: 5ms
memory: 13076kb
input:
1923
output:
13
result:
ok single line: '13'
Test #12:
score: 0
Accepted
time: 2ms
memory: 13132kb
input:
1924
output:
11
result:
ok single line: '11'
Test #13:
score: 0
Accepted
time: 0ms
memory: 13076kb
input:
1925
output:
10
result:
ok single line: '10'
Test #14:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1926
output:
9
result:
ok single line: '9'
Test #15:
score: 0
Accepted
time: 5ms
memory: 12956kb
input:
1927
output:
8
result:
ok single line: '8'
Test #16:
score: 0
Accepted
time: 0ms
memory: 13004kb
input:
1928
output:
13
result:
ok single line: '13'
Test #17:
score: 0
Accepted
time: 2ms
memory: 13124kb
input:
1929
output:
12
result:
ok single line: '12'
Test #18:
score: 0
Accepted
time: 0ms
memory: 12988kb
input:
1930
output:
11
result:
ok single line: '11'
Test #19:
score: 0
Accepted
time: 2ms
memory: 13044kb
input:
1931
output:
10
result:
ok single line: '10'
Test #20:
score: 0
Accepted
time: 0ms
memory: 13056kb
input:
1932
output:
8
result:
ok single line: '8'
Test #21:
score: 0
Accepted
time: 0ms
memory: 13056kb
input:
1933
output:
14
result:
ok single line: '14'
Test #22:
score: 0
Accepted
time: 0ms
memory: 13000kb
input:
1934
output:
13
result:
ok single line: '13'
Test #23:
score: 0
Accepted
time: 2ms
memory: 13060kb
input:
1935
output:
12
result:
ok single line: '12'
Test #24:
score: 0
Accepted
time: 0ms
memory: 13120kb
input:
1936
output:
10
result:
ok single line: '10'
Test #25:
score: 0
Accepted
time: 0ms
memory: 13064kb
input:
1937
output:
9
result:
ok single line: '9'
Test #26:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1938
output:
8
result:
ok single line: '8'
Test #27:
score: 0
Accepted
time: 0ms
memory: 13116kb
input:
1939
output:
14
result:
ok single line: '14'
Test #28:
score: 0
Accepted
time: 0ms
memory: 13124kb
input:
1940
output:
12
result:
ok single line: '12'
Test #29:
score: 0
Accepted
time: 0ms
memory: 13120kb
input:
1941
output:
11
result:
ok single line: '11'
Test #30:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1942
output:
10
result:
ok single line: '10'
Test #31:
score: 0
Accepted
time: 5ms
memory: 13060kb
input:
1943
output:
9
result:
ok single line: '9'
Test #32:
score: 0
Accepted
time: 5ms
memory: 13064kb
input:
1944
output:
14
result:
ok single line: '14'
Test #33:
score: 0
Accepted
time: 5ms
memory: 13060kb
input:
1945
output:
13
result:
ok single line: '13'
Test #34:
score: 0
Accepted
time: 5ms
memory: 13052kb
input:
1946
output:
12
result:
ok single line: '12'
Test #35:
score: 0
Accepted
time: 2ms
memory: 13128kb
input:
1947
output:
11
result:
ok single line: '11'
Test #36:
score: 0
Accepted
time: 2ms
memory: 13124kb
input:
1948
output:
9
result:
ok single line: '9'
Test #37:
score: 0
Accepted
time: 0ms
memory: 12988kb
input:
1949
output:
8
result:
ok single line: '8'
Test #38:
score: 0
Accepted
time: 2ms
memory: 13056kb
input:
1950
output:
14
result:
ok single line: '14'
Test #39:
score: 0
Accepted
time: 5ms
memory: 12992kb
input:
1951
output:
13
result:
ok single line: '13'
Test #40:
score: 0
Accepted
time: 2ms
memory: 13128kb
input:
1952
output:
11
result:
ok single line: '11'
Test #41:
score: 0
Accepted
time: 0ms
memory: 13072kb
input:
1953
output:
10
result:
ok single line: '10'
Test #42:
score: 0
Accepted
time: 0ms
memory: 13052kb
input:
1954
output:
9
result:
ok single line: '9'
Test #43:
score: 0
Accepted
time: 0ms
memory: 12996kb
input:
1955
output:
8
result:
ok single line: '8'
Test #44:
score: 0
Accepted
time: 0ms
memory: 13056kb
input:
1956
output:
13
result:
ok single line: '13'
Test #45:
score: 0
Accepted
time: 5ms
memory: 13072kb
input:
1957
output:
12
result:
ok single line: '12'
Test #46:
score: 0
Accepted
time: 0ms
memory: 13128kb
input:
1958
output:
11
result:
ok single line: '11'
Test #47:
score: 0
Accepted
time: 0ms
memory: 13128kb
input:
1959
output:
10
result:
ok single line: '10'
Test #48:
score: 0
Accepted
time: 0ms
memory: 12940kb
input:
1960
output:
8
result:
ok single line: '8'
Test #49:
score: 0
Accepted
time: 0ms
memory: 12956kb
input:
1961
output:
14
result:
ok single line: '14'
Test #50:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1962
output:
13
result:
ok single line: '13'
Test #51:
score: 0
Accepted
time: 0ms
memory: 13004kb
input:
1963
output:
12
result:
ok single line: '12'
Test #52:
score: 0
Accepted
time: 2ms
memory: 13076kb
input:
1964
output:
10
result:
ok single line: '10'
Test #53:
score: 0
Accepted
time: 0ms
memory: 13120kb
input:
1965
output:
9
result:
ok single line: '9'
Test #54:
score: 0
Accepted
time: 0ms
memory: 12992kb
input:
1966
output:
8
result:
ok single line: '8'
Test #55:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1967
output:
14
result:
ok single line: '14'
Test #56:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1968
output:
12
result:
ok single line: '12'
Test #57:
score: 0
Accepted
time: 4ms
memory: 13128kb
input:
1969
output:
11
result:
ok single line: '11'
Test #58:
score: 0
Accepted
time: 0ms
memory: 13048kb
input:
1970
output:
10
result:
ok single line: '10'
Test #59:
score: 0
Accepted
time: 0ms
memory: 12992kb
input:
1971
output:
9
result:
ok single line: '9'
Test #60:
score: 0
Accepted
time: 2ms
memory: 13000kb
input:
1972
output:
14
result:
ok single line: '14'
Test #61:
score: 0
Accepted
time: 0ms
memory: 13000kb
input:
1973
output:
13
result:
ok single line: '13'
Test #62:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1974
output:
12
result:
ok single line: '12'
Test #63:
score: 0
Accepted
time: 4ms
memory: 13068kb
input:
1975
output:
11
result:
ok single line: '11'
Test #64:
score: 0
Accepted
time: 0ms
memory: 13116kb
input:
1976
output:
9
result:
ok single line: '9'
Test #65:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1977
output:
8
result:
ok single line: '8'
Test #66:
score: 0
Accepted
time: 0ms
memory: 13084kb
input:
1978
output:
14
result:
ok single line: '14'
Test #67:
score: 0
Accepted
time: 5ms
memory: 13080kb
input:
1979
output:
13
result:
ok single line: '13'
Test #68:
score: 0
Accepted
time: 0ms
memory: 13068kb
input:
1980
output:
11
result:
ok single line: '11'
Test #69:
score: 0
Accepted
time: 0ms
memory: 12992kb
input:
1981
output:
10
result:
ok single line: '10'
Test #70:
score: 0
Accepted
time: 0ms
memory: 12940kb
input:
1982
output:
9
result:
ok single line: '9'
Test #71:
score: 0
Accepted
time: 5ms
memory: 13064kb
input:
1983
output:
8
result:
ok single line: '8'
Test #72:
score: 0
Accepted
time: 0ms
memory: 13048kb
input:
1984
output:
13
result:
ok single line: '13'
Test #73:
score: 0
Accepted
time: 0ms
memory: 13100kb
input:
1985
output:
12
result:
ok single line: '12'
Test #74:
score: 0
Accepted
time: 2ms
memory: 13000kb
input:
1986
output:
11
result:
ok single line: '11'
Test #75:
score: 0
Accepted
time: 0ms
memory: 12988kb
input:
1987
output:
10
result:
ok single line: '10'
Test #76:
score: 0
Accepted
time: 0ms
memory: 13068kb
input:
1988
output:
8
result:
ok single line: '8'
Test #77:
score: 0
Accepted
time: 0ms
memory: 13044kb
input:
1989
output:
14
result:
ok single line: '14'
Test #78:
score: 0
Accepted
time: 0ms
memory: 13076kb
input:
1990
output:
13
result:
ok single line: '13'
Test #79:
score: 0
Accepted
time: 0ms
memory: 12980kb
input:
1991
output:
12
result:
ok single line: '12'
Test #80:
score: 0
Accepted
time: 5ms
memory: 13060kb
input:
1992
output:
10
result:
ok single line: '10'
Test #81:
score: 0
Accepted
time: 0ms
memory: 13076kb
input:
1993
output:
9
result:
ok single line: '9'
Test #82:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1994
output:
8
result:
ok single line: '8'
Test #83:
score: 0
Accepted
time: 0ms
memory: 13068kb
input:
1995
output:
14
result:
ok single line: '14'
Test #84:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
1996
output:
12
result:
ok single line: '12'
Test #85:
score: 0
Accepted
time: 0ms
memory: 13080kb
input:
1997
output:
11
result:
ok single line: '11'
Test #86:
score: 0
Accepted
time: 0ms
memory: 13116kb
input:
1998
output:
10
result:
ok single line: '10'
Test #87:
score: 0
Accepted
time: 4ms
memory: 13056kb
input:
1999
output:
9
result:
ok single line: '9'
Test #88:
score: 0
Accepted
time: 0ms
memory: 13000kb
input:
2000
output:
14
result:
ok single line: '14'
Test #89:
score: 0
Accepted
time: 0ms
memory: 12996kb
input:
2001
output:
13
result:
ok single line: '13'
Test #90:
score: 0
Accepted
time: 5ms
memory: 13064kb
input:
2002
output:
12
result:
ok single line: '12'
Test #91:
score: 0
Accepted
time: 0ms
memory: 13076kb
input:
2003
output:
11
result:
ok single line: '11'
Test #92:
score: 0
Accepted
time: 0ms
memory: 13064kb
input:
2004
output:
9
result:
ok single line: '9'
Test #93:
score: 0
Accepted
time: 4ms
memory: 12984kb
input:
2005
output:
8
result:
ok single line: '8'
Test #94:
score: 0
Accepted
time: 5ms
memory: 13040kb
input:
2006
output:
14
result:
ok single line: '14'
Test #95:
score: 0
Accepted
time: 5ms
memory: 12996kb
input:
2007
output:
13
result:
ok single line: '13'
Test #96:
score: 0
Accepted
time: 0ms
memory: 13052kb
input:
2008
output:
11
result:
ok single line: '11'
Test #97:
score: 0
Accepted
time: 0ms
memory: 13060kb
input:
2009
output:
10
result:
ok single line: '10'
Test #98:
score: 0
Accepted
time: 0ms
memory: 13080kb
input:
2010
output:
9
result:
ok single line: '9'
Test #99:
score: 0
Accepted
time: 5ms
memory: 13000kb
input:
2011
output:
8
result:
ok single line: '8'
Test #100:
score: 0
Accepted
time: 0ms
memory: 13056kb
input:
2012
output:
13
result:
ok single line: '13'
Test #101:
score: 0
Accepted
time: 0ms
memory: 13124kb
input:
2013
output:
12
result:
ok single line: '12'
Test #102:
score: 0
Accepted
time: 0ms
memory: 13120kb
input:
2014
output:
11
result:
ok single line: '11'
Test #103:
score: 0
Accepted
time: 0ms
memory: 13064kb
input:
2015
output:
10
result:
ok single line: '10'
Test #104:
score: 0
Accepted
time: 2ms
memory: 13080kb
input:
2016
output:
8
result:
ok single line: '8'
Test #105:
score: 0
Accepted
time: 5ms
memory: 13064kb
input:
2017
output:
14
result:
ok single line: '14'
Test #106:
score: 0
Accepted
time: 0ms
memory: 13128kb
input:
2018
output:
13
result:
ok single line: '13'
Test #107:
score: 0
Accepted
time: 0ms
memory: 12996kb
input:
2019
output:
12
result:
ok single line: '12'