rt Julian那题爆零了
但是我洛谷上重测后是有70分的
求大佬看看qwq
#include<bits/stdc++.h>
using namespace std ;
int read(){
int ans = 0 , f = 1 ; char ch = getchar() ;
while(!isdigit(ch)){if(ch == '-') f = -1 ; ch = getchar() ; }
while(isdigit(ch)){ans = ans * 10 + (ch ^ '0') ; ch = getchar() ; }
return ans * f ;
}
#define int long long
int q , r ;
int mth[13] = {0 , 31 , 28 , 31 , 30 , 31 , 30 , 31 , 31 , 30 , 31 , 30 , 31} ;
bool check1(int y){
return y % 4 == 1;
}
bool check2(int y){
return y % 4 == 0 ;
}
void substack1(int x){
int yea = 4713 , mo = 1 , ri = 1 ;
int num = x / 1461 ;
x -= num * 1461 ;
yea -= 4 * num ;
while(x){
x-- ;
ri++ ;
if(ri > mth[mo]){
if(mo == 2){
if(check1(yea) && ri == 29)
continue ;
else ri = 1 , mo = 3 ;
}
else mo++ , ri = 1 ;
}
if(mo == 13)
yea-- , mo = 1 ;
}
printf("%d %d %d BC\n" , ri , mo , yea) ;
}
void substack2(int x){
int yea = 1 , mo = 1 , ri = 1 ;
int num = x / 1461 ;
x -= num * 1461 ;
yea += 4 * num ;
while(x){
x-- ;
ri++ ;
if(ri > mth[mo]){
if(mo == 2){
if(check2(yea) && ri == 29)
continue ;
else ri = 1 , mo = 3 ;
}
else mo++ , ri = 1 ;
}
if(mo == 13)
yea++ , mo = 1 ;
}
printf("%d %d %d\n" , ri , mo , yea) ;
}
void substack3(int x){
int yea = 1581 , mo = 1 , ri = 1 ;
while(x){
x-- ;
ri++ ;
if(ri > mth[mo]){
if(mo == 2){
if(check2(yea) && ri == 29)
continue ;
else ri = 1 , mo = 3 ;
}
else mo++ , ri = 1 ;
}
if(mo == 13)
yea++ , mo = 1 ;
}
printf("%d %d %d\n" , ri , mo , yea) ;
}
bool check3(int y){
if(y % 400 == 0) return 1 ;
if(y % 100 == 0) return 0 ;
if(y % 4 == 0) return 1 ;
return 0 ;
}
void substack4(int x){
int yea = 1582 , mo = 10 , ri = 15 ;
while(x){
x-- ;
ri++ ;
if(ri > mth[mo]){
if(mo == 2){
if(check3(yea) && ri == 29)
continue ;
else ri = 1 , mo = 3 ;
}
else mo++ , ri = 1 ;
}
if(mo == 13)
yea++ , mo = 1 ;
if(yea == 1600) break ;
}
if(x == 0){
printf("%d %d %d\n" , ri , mo , yea) ;
return ;
}
int num = x / 146097 ;
x -= 146097 * num ;
yea += 400 * num ;
if(x <= 365){
while(x){
x-- ;
ri++ ;
if(ri > mth[mo]){
if(mo == 2){
if(check3(yea) && ri == 29)
continue ;
else ri = 1 , mo = 3 ;
}
else mo++ , ri = 1 ;
}
if(mo == 13)
yea++ , mo = 1 ;
}
printf("%d %d %d\n" , ri , mo , yea) ;
return ;
}
else {
while(x){
int now ;
if(check3(yea))
now = 366 ;
else now = 365 ;
if(x >= now) x -= now , yea++ ;
else break ;
}
while(x){
x-- ;
ri++ ;
if(ri > mth[mo]){
if(mo == 2){
if(check3(yea) && ri == 29)
continue ;
else ri = 1 , mo = 3 ;
}
else mo++ , ri = 1 ;
}
if(mo == 13)
yea++ , mo = 1 ;
}
printf("%d %d %d\n" , ri , mo , yea) ;
return ;
}
}
#undef int
int main(){
#define int long long
// freopen("julian.in" , "r" , stdin) ;
// freopen("julian.out" , "w" , stdout) ;
q = read() ;
while(q--){
r = read() ;
if(r <= 1721423){
substack1(r) ;
}
else {
r -= 1721424 ;
if(r <= 577095){
substack2(r) ;
}
else {
r -= 577095 ;
if(r <= 641)
substack3(r) ;
else {
r -= 642 ;
substack4(r) ;
}
}
}
}
// cout << 400 * 365 + 97 ;
return 0 ;
}
考场是没有注释julian的