题目链接https://atcoder.jp/contests/abc200
A - Century
简单的abs(n-1)/100+1即可
B - 200th ABC-200
按题意写代码
点击查看代码
void solve(){
int n,k;cin>>n>>k;
for(int i=1;i<=k;i++)
{
if(n%200==0)n/=200;
else n=n*1000+200;
}
cout<<n;
}
点击查看代码
void solve(){
int n,k;cin>>n;
map<int,int>mp;
vector<int>a(n);
int sum=0;
for(int i=0;i<n;i++){
cin>>a[i];a[i]%=200;
sum+=mp[a[i]];
mp[a[i]]++;
}
cout<<sum;
}
点击查看代码
#include<bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define pii pair<int,int>
using namespace std;
//const int mod=998244353;
//int qpw(int a,int b){int ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
//int inv(int x){return qpw(x,mod-2);}
const int maxn=1e6+10;
int dp[200];
unordered_map<int,vector<int>>mp;
void print(vector<int>v){
cout<<v.size()<<" ";
for(auto t:v)cout<<t<<" ";
cout<<'\n';
}
void solve(){
int n;cin>>n;vector<int>a(n);
for(int i=0;i<n;i++)cin>>a[i];
n=min(n,8ll);
for(int i=1;i<(1<<n);i++){
int sum=0;
vector<int>ans;
for(int k=0;k<n;k++){
if(i>>k&1)sum+=a[k],ans.pb(k+1);
}
if(mp[sum%200].size()){cout<<"Yes\n";print(mp[sum%200]),print(ans);return;}
else mp[sum%200]=ans;
}
cout<<"No\n";
}
signed main(){
ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
int _=1;
// cin>>_;
while(_--)solve();
}
#include<bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define pii pair<int,int>
using namespace std;
//const int mod=998244353;
//int qpw(int a,int b){int ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
//int inv(int x){return qpw(x,mod-2);}
int get(int x){return x<=2?0:(x-1)*(x-2)/2;}
void solve(){
int n,k;cin>>n>>k;
for(int s=3;s<=n*3;s++){
int t=get(s)-get(s-n)*3+get(s-2*n)*3-get(s-3*n);
if(k>t){k-=t;continue;}
for(int i=1;i<=n;i++){
int mij=max(s-i-n,1ll),maj=min(s-i-1,n);
if(mij>maj)continue;
int num=maj-mij+1;
if(k>num){k-=num;continue;}
int j=mij+k-1;
cout<<i<<" "<<j<<" "<<s-i-j;
return;
}
}
}
signed main(){
ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
int _=1;
// cin>>_;
while(_--)solve();
}
标签:AtCoder,200,int,get,Contest,ans,mod,define
From: https://www.cnblogs.com/archer233/p/18111741