1 条题解
-
0
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6+5,P=7; const int inf = 0x3f3f3f3f; ll gcd(ll a,ll b){ return b==0? a: gcd(b, a%b); } char ans[][20] ={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; int halfpow(int a,int b){ // a^b if(b==1) return a; int res = halfpow(a, b/2) % P; res = res * res % P; if(b%2) res = res *a % P; return res; } int pw(int a,int b){ // a^b int res=1; for(int i=1; i<=b; i++){ res = res*a % P; } return res; } void solve(){ int a,b; cin>>a>>b; int x = (7+ pw(a,b)) % 7; int y = (7+ halfpow(a,b)) % 7; cout<<ans[x]<<endl;// 可以通过 // cout<<ans[y]<<endl;// 可以通过 } int main(){ int t = 1; // cin>>t; while(t --){ solve(); } return 0; }
- 1
信息
- ID
- 64
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 6
- 标签
- 递交数
- 147
- 已通过
- 44
- 上传者