为啥ans太短了?
查看原帖
为啥ans太短了?
1780524
Mrzhu2014楼主2025/7/22 23:10

~cpp

#include <bits/stdc++.h>
using namespace std;
int a,b;
long long ans=1;
int main(){
    cin>>a>>b;
    a%=7;
    for(int i=1;i<=b;i++){
        ans*=a;
        ans%=7;
    }
    if(ans==1) cout<<"Monday";
    if(ans==2) cout<<"Tuesday";
    if(ans==3) cout<<"Wednesday";
    if(ans==4) cout<<"Thursday";
    if(ans==5) cout<<"Friday";
    if(ans==6) cout<<"Saturday";
    if(ans==7) cout<<"Sunday";
    return 0;
}

为什么代码第四个测试样例过不了?

大佬求解! Why I cannot find the answer of this problem?

2025/7/22 23:10
加载中...