QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#253943#6697. CalandarLionel_ZQY#AC ✓0ms3592kbC++20952b2023-11-17 20:34:252023-11-17 20:34:27

Judging History

你现在查看的是最新测评结果

  • [2023-11-17 20:34:27]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3592kb
  • [2023-11-17 20:34:25]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

void solve(){
	i64 y0,m0,d0,y1,m1,d1;
	string s0;
	cin>>y0>>m0>>d0>>s0;
	cin>>y1>>m1>>d1;
	i64 c=(y0-y1)*360LL+(m0-m1)*30LL+(d0-d1);
	if(c==0){
		cout<<s0<<'\n';
		return;
	}
	int ok=(c>0?-1:1);
	c=abs(c);
	i64 n0=0;
	if(s0=="Monday"){
		n0=0;
	}else if(s0=="Tuesday"){
		n0=1;
	}else if(s0=="Wednesday"){
		n0=2;		
	}else if(s0=="Thursday"){
		n0=3;		
	}else if(s0=="Friday"){
		n0=4;		
	}
	c%=5;
	// cout<<n0<<' '<<c<<'\n';
	if(ok==1){
		n0=(n0+c)%5;
	}else{
		n0=(n0-c+5)%5;
	}
	// cout<<n0<<'\n';
	if(n0==0){
		cout<<"Monday\n";
	}else if(n0==1){
		cout<<"Tuesday\n";
	}else if(n0==2){
		cout<<"Wednesday\n";
	}else if(n0==3){
		cout<<"Thursday\n";
	}else if(n0==4){
		cout<<"Friday\n";
	}

}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);

	int t;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3548kb

input:

4
2019 5 12 Monday
2019 5 14
2019 5 12 Tuesday
2019 12 30
2019 5 12 Friday
1000000000 1 1
1000000000 1 1 Wednesday
2019 5 12

output:

Wednesday
Friday
Thursday
Thursday

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

100
60523000 9 6 Tuesday
667062297 1 19
818045248 9 22 Wednesday
950448235 4 11
347752308 10 25 Thursday
18640223 2 6
740295050 11 22 Wednesday
185496318 7 25
905846973 3 14 Tuesday
132078200 7 11
748835058 9 22 Wednesday
863118887 3 24
225924970 2 17 Wednesday
807058915 11 19
326750305 4 30 Wednesd...

output:

Friday
Tuesday
Friday
Monday
Thursday
Friday
Friday
Thursday
Monday
Monday
Friday
Tuesday
Thursday
Monday
Friday
Friday
Wednesday
Monday
Tuesday
Thursday
Wednesday
Thursday
Friday
Tuesday
Tuesday
Friday
Monday
Tuesday
Thursday
Monday
Tuesday
Wednesday
Wednesday
Monday
Thursday
Wednesday
Wednesday
Fr...

result:

ok 100 lines