柚子快報(bào)激活碼778899分享:【交互題】
柚子快報(bào)激活碼778899分享:【交互題】
目錄
1 cf 1167B?Lost Numbers
2 cf 1807E?Interview
3 cf 1713D?Tournament Countdown
1 cf 1167B?Lost Numbers
https://codeforces.com/contest/1167/problem/B
代碼:
// Problem: B. Lost Numbers
// Contest: Codeforces - Educational Codeforces Round 65 (Rated for Div. 2)
// URL: https://codeforces.com/problemset/problem/1167/B
// Memory Limit: 256 MB
// Time Limit: 1000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#include
using namespace std;
#define int long long
const int N = 2e5+5;
int a[7]={0,4,8,15,16,23,42};
int q1,q2,q3,q4;
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout<<"? 1 2"< fflush(stdout); cin>>q1; cout<<"? 2 3"< fflush(stdout); cin>>q2; cout<<"? 3 4"< fflush(stdout); cin>>q3; cout<<"? 4 5"< fflush(stdout); cin>>q4; int shu[7]; do{ if(a[1]*a[2]==q1&&a[2]*a[3]==q2&&a[3]*a[4]==q3&&a[4]*a[5]==q4){ shu[1]=a[1]; shu[2]=a[2]; shu[3]=a[3]; shu[4]=a[4]; shu[5]=a[5]; break; } }while(next_permutation(a+1,a+6+1)); shu[6]=(4+8+15+16+23+42)-shu[1]-shu[2]-shu[3]-shu[4]-shu[5]; cout<<"! "; for(int i=1;i<=6;i++){ cout< } cout<<"\n"; return 0; } 2 cf 1807E?Interview https://codeforces.com/contest/1807/problem/E 代碼: // Problem: E. Interview // Contest: Codeforces - Codeforces Round 859 (Div. 4) // URL: https://codeforces.com/contest/1807/problem/E // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include using namespace std; #define int long long const int N = 2e5+5; int n; int a[N],s[N]; signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin>>T; while(T--){ cin>>n; for(int i=1;i<=n;i++){ a[i]=0; s[i]=0; } for(int i=1;i<=n;i++){ cin>>a[i]; s[i]=s[i-1]+a[i]; } int l=1,r=n,ans=0; while(l int mid=(l+r)/2; int shu=s[mid]-s[l-1]; cout<<"? "< for(int i=l;i<=mid;i++){ cout< } cout< fflush(stdout); ans=0; cin>>ans; if(ans==shu){ l=mid+1; } else{ r=mid; } } cout<<"! "< } return 0; } 3 cf 1713D?Tournament Countdown https://codeforces.com/contest/1713/problem/D 代碼: // Problem: D. Tournament Countdown // Contest: Codeforces - Codeforces Round 812 (Div. 2) // URL: https://codeforces.com/problemset/problem/1713/D // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include using namespace std; #define int long long const int N = 2e5+5; int n; int query(int a,int b){ cout<<"? "< int res; cin>>res; return res; } signed main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin>>T; while(T--){ cin>>n; vector iota(a.begin(),a.end(),0); while(a.size()>=4){ vector for(int i=0;i int x=query(a[i],a[i+2]); if(x==0){ if(query(a[i+1],a[i+3])==1){ b.push_back(a[i+1]); } else{ b.push_back(a[i+3]); } } else if(x==1){ if(query(a[i],a[i+3])==1){ b.push_back(a[i]); } else{ b.push_back(a[i+3]); } } else{ if(query(a[i+1],a[i+2])==1){ b.push_back(a[i+1]); } else{ b.push_back(a[i+2]); } } } a=b; } if(a.size()==2){ if(query(a[0],a[1])==1){ a={a[0]}; } else{ a={a[1]}; } } cout<<"! "< } return 0; } 柚子快報(bào)激活碼778899分享:【交互題】 精彩文章
本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點(diǎn)和立場。
轉(zhuǎn)載請注明,如有侵權(quán),聯(lián)系刪除。