QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#469599#6697. Calandarmufeng12#AC ✓1ms3788kbC++142.6kb2024-07-09 20:34:592024-07-09 20:34:59

Judging History

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

  • [2024-07-09 20:34:59]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3788kb
  • [2024-07-09 20:34:59]
  • 提交

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define all(x) (x).begin(),(x).end()
#define maxint INT32_MAX
#define minint INT32_MIN
#define maxll INT64_MAX
#define minll INT64_MIN
#define nc() (p1==p2 && (p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
#pragma GCC optimize(2)
void write(int x);
char *p1,*p2,buf[100000];
int read();
ll ksm(ll a,ll b,ll mod);
int js(int a,int b,int c){
    int ans1,ans;
    ans1=a+b>a*b?a+b:a*b;
    ans=ans1+c>ans1*c?ans1+c:ans1*c;
    return ans;
}

void solve(){
    ll y1,m1,d1,y2,m2,d2,s;
    string s1;
    cin>>y1>>m1>>d1>>s1;
    cin>>y2>>m2>>d2;
    if(s1[1]=='o'){
        s=0;
    }else if(s1[1]=='u'){
        s=1;
    }else if(s1[1]=='e'){
        s=2;
    }else if(s1[1]=='h'){
        s=3;
    }else {s=4;}
    ll days1=360*y1+30*m1+d1;
    ll days2=360*y2+30*m2+d2;
    if(days2>=days1){
        ll dayc=days2-days1;
        dayc=dayc%5;
        s=(s+dayc)%5;
        if(s==0){cout<<"Monday"<<endl;}
        else if(s==1){cout<<"Tuesday"<<endl;}
        else if(s==2){cout<<"Wednesday"<<endl;}
        else if(s==3){cout<<"Thursday"<<endl;}
        else {cout<<"Friday"<<endl;}
    }
    else{
        ll dayc=days1-days2;
        dayc=dayc%5;
        s=(s-dayc)%5;
        //cout<<s<<endl;
        if(s<0){s+=5;}
        if(s==0){cout<<"Monday"<<endl;}
        else if(s==1){cout<<"Tuesday"<<endl;}
        else if(s==2){cout<<"Wednesday"<<endl;}
        else if(s==3){cout<<"Thursday"<<endl;}
        else {cout<<"Friday"<<endl;}

    }
    return ;
}


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



void write(int x)
{
    if(x<0)
        putchar('-'),x=-x;
    if(x>9)
        write(x/10);
    putchar(x%10+'0');
    return;
}
int read()
{
    int x=0,f=1;
    char ch=nc();
    while(ch<48||ch>57)
    {
        if(ch=='-')
            f=-1;
        ch=nc();
    }
    while(ch>=48&&ch<=57)
        x=x*10+ch-48,ch=nc();
   	return x*f;
}
ll ksm(ll a,ll b,ll mod){
    ll ans=1;
    a%=mod;
    while(b>0){
        if(b&1) ans=ans*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return ans;
}

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

詳細信息

Test #1:

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

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: 1ms
memory: 3584kb

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