Wneosy 题解分享 · 2025/1/8
星期计算(结果填空) - 题解
``` #include<bits/stdc++.h> using namespace std; int main(){ int res=1; int currentDay=6; for(int i = 1;i <= 22;i++){ res = (res%7)*20%7; } int nextDay=(currentDay+res - 1)%7 + 1; cout<<nextDay<<endl; } ```
查看全文
3 0 1 10
chenchen 题解分享 · 2025/3/12
星期计算(结果填空) - 题解
``` #include <bits/stdc++.h> #define endl '\n' using namespace std; using ll = long long; using ULL = unsigned long long; const int N = 1e6+5; int power(int a,int b,int p){ int ans = 1 % p; for(; b; b >>= 1){ if(b & 1) ans = ans * a % p; a = a * a % p; } return ans; } inline void solve() { cout << power(20,22,7) + 6; } int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int _ = 1; //int _; cin >> _; while (_--) solve(); return 0; } ```
查看全文
2 0 0 3
lll 题解分享 · 2024/4/3
星期计算(结果填空) - 题解
```java import java.util.*; public class Main { public static void main(String[] args) { double pow = Math.pow(20, 22) % 7; System.out.println(pow); } } ``` pow为1 所以 6+1=7
4 0 0 9
ppy 题解分享 · 2024/4/12
星期计算(结果填空) - 题解
//2020%7=1 //202020%7=6 //循环22次为1,加上6
3 0 0 18
nihao 题解分享 · 2024/4/5
星期计算(结果填空) - 题解
``` public class Main { public static void main(String[] args) { int now=6; // 可以进行适当的化简 // 我们发现(20*20)%7=1 // (20)^22变成了(1)^11 // 于是结果为 1+6=7 System.out.println(1+now); // 正常做法 // int res = 20; // for(int i=1;i<22;i++) { // res*=20; // res=res%7; // } // System.out.println(res+now); } } ```
查看全文
2 0 1 15
xiaoxin 题解分享 · 2024/4/6
星期计算(结果填空) - 题解
``` #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> typedef long long ll; using namespace std; int main(){ ll tianshu=1 ; for(int i=1;i<=22;i++){ tianshu*=20; tianshu%=7; } int dayIn=6; int res=(6+tianshu-1)%7+1;cout<<res; } ```
查看全文
2 0 1 9
lettinggo 题解分享 · 2024/4/12
星期计算(结果填空) - 题解
``` #include<iostream> #include<string> #include<vector> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long ans=1; for(int i=1;i<=2;i++){ ans=(ans*20)%7; }//经过了几天 int day=6; for(int i=1;i<=ans;i++){ day++; if(day==8) day=1; } cout<<day; return 0; } ```
查看全文
2 0 0 8
chushiyue 题解分享 · 2024/4/4
星期计算(结果填空) - 题解
```cpp #include <iostream> using namespace std; int main() { int res = 6, n = 1; for (int i = 0; i < 22; i++) { n *= 20; n %= 7; } cout << (res + n - 1) % 7 + 1; return 0; } ``` res 存结果,当前为周六,n 存 20^22 的值 n乘22次20,每次模7 最后打印当前是周几
查看全文
2 0 0 8
Sakamotokyo 题解分享 · 2024/4/4
星期计算(结果填空) - 题解
``` //快速幂做法 #include <vector> #include <iostream> #include <cmath> using namespace std; int main() { vector<int> t; //将幂转化为2进制, t储存 int b = 20, e = 22; int ans = 1; for(int i = 0; i < 10; i ++ ) { int r = e % 2; t.push_back(r); e /= 2; if(e == 0) break ; } for(int i = 0; i < t.size(); i ++ ) { int x = pow(20, pow(2, t[i])); ans = ans * x % 7; } cout << ans; } ```
查看全文
1 0 0 5
Aisakave. 题解分享 · 2025/3/11
星期计算(结果填空) - 题解
include using namespace std; define endl '\n' using ll = long long; ll power(ll a, int b, int mod){ ll ans = 1; while(b > 0){ if((b & 1 == 1)){ ans = (ans a) % mod; } a = (a a) % mod; b >>= 1; } return ans; } int main() { int cur = 6; ll day = power(20, 22, 7); int fut = (cur + day) % 7; if(fut == 0){ fut = 7; } cout << fut << endl; return 0; }
查看全文
0 0 0 13