Codeforces Round #628 (Div. 2)【A B C D】

Cybill ·
更新时间:2024-09-20
· 949 次阅读

传送门

A. EhAb AnD gCd

直接输出1,n-1即可

#include #include #include #include #include #include #include #include #include #include #define pb push_back #define lb lower_bound #define ub upper_bound #define rep(i,a,b) for(int i=a;i=b;i--) typedef long long ll; using namespace std; const int MAXN=1e5+50; const int inf=0x3f3f3f3f; const int M=5000*4; int a[MAXN]; int main() { std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); int t; cin>>t; ll n; while(t--){ cin>>n; cout<<1<<" "<<n-1<<endl; } return 0; } /* */ B. CopyCopyCopyCopyCopy

找数组中一共有多少个不同的元素
(可以直接放到set里,输出set的长度即可,set可以去重)

#include #include #include #include #include #include #include #include #include #include #define pb push_back #define lb lower_bound #define ub upper_bound #define rep(i,a,b) for(int i=a;i=b;i--) typedef long long ll; using namespace std; const int MAXN=1e5+50; const int inf=0x3f3f3f3f; const int M=5000*4; int a[MAXN]; int main() { std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0); int t; cin>>t; int n; while(t--){ mapp; cin>>n; int ans=0; rep(i,1,n){ cin>>a[i]; if(p[a[i]]==0){ p[a[i]]=1; ans++; } } cout<<ans<<endl; } return 0; } /* */ C.Ehab and Path-etic MEXs Codeforces Round #628 (Div.2) C.Ehab and Path-etic MEXs(树,思维) D. Ehab the Xorcist Codeforces Round #628 (Div. 2) D. Ehab the Xorcist(异或构造,思维)
作者:_Alexander



CodeForces round div

需要 登录 后方可回复, 如果你还没有账号请 注册新账号