4 条题解
-
2陈烨鑫 (chenyexin) LV 10 @ 2023-4-21 21:32:48
#include<bits/stdc++.h> #define fi first #define se second #define INF 0x3f3f3f3f #define ll long long #define ld long double #define mem(ar,num) memset(ar,num,sizeof(ar)) #define me(ar) memset(ar,0,sizeof(ar)) #define lowbit(x) (x&(-x)) #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define lcm(a,b) ((a)*(b)/(__gcd((a),(b)))) using namespace std; const int N = 1e3 + 10; const int mod = 1e9 + 7; ll n; int main() { ll ans = 0; cin >> n; if(!(n & 1)) n++, ans = n; ll num = (n + 1ll) / 2ll; if(num & 1) ans ^= 1; cout << ans; return 0; }
-
02023-4-29 11:30:57@
/*60代码 #pragma GCC optimize(3) #include<bits/stdc++.h> using namespace std; long long ans = 1; int main() { long long n; cin >> n; for (int i = 2; i <= n; i++) ans = (ans ^ i); cout << ans << endl; } */
/*80代码 #include<bits/stdc++.h> using namespace std; long long ans = 1; int main() { int n; cin >> n; while (n != 0) { if (n & 1 == 0) { cout << 1; return 0; } // cout << n << endl; n = (n >> 1); } cout << 0; return 0; } */
//100AC #include<bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; int k = n % 4; if (k == 1) cout << 1; else if (k == 2) cout << n + 1; else if (k == 3) cout << 0; else cout << n; return 0; }
-
02023-4-29 11:27:56@
/*找规律: 1. 1 2. 3 3. 0 4 .4 5. 1 6. 7 7 .0 8. 9 ... */ #include<iostream> using namespace std; long long n; signed main(){ cin>>n; switch (n%4) { case 0: cout<<n; break; case 1: cout<<1; break; case 2: cout<<n+1; break; default: cout<<0; } return 0; }
-
02023-4-29 11:24:12@
#include<bits/stdc++.h> using namespace std; #define int long long int n; signed main(){ cin>>n; if(n%4==3) cout<<0<<endl; if(n%4==0) cout<<n<<endl; if(n%4==1) cout<<1<<endl; if(n%4==2) cout<<((n/4+1)*4)-1<<endl; return 0; }
- 1
信息
- ID
- 2555
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 8
- 标签
- 递交数
- 597
- 已通过
- 108
- 上传者