概述
和队友进行了这场模拟赛,本弱只做出来五题......
当然队伍总共过了九题,,算是不错的成绩了.
A
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define fi first
#define se second
#define mk(x,y) make_pair(x,y)
const int mod=1e9+7;
const int maxn=1e2+10;
const int ub=1e6;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
string x,y,ans="";
int solve(int x,int y){
return abs(x-y);
}
int flag=1;
int main(){
cin>>x>>y;
int len=x.size();
rep(i,0,len){
int tmp=solve(x[i]-'0',y[i]-'0');
if(tmp==0&&flag) continue;
flag=0;
ans+=('0'+tmp);
}
if(ans=="") ans+='0';
cout<<ans;
return 0;
}
E
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define fi first
#define se second
#define mk(x,y) make_pair(x,y)
const int mod=1e9+7;
const int maxn=1e5+10;
const int ub=1e6;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
int bit[maxn];
void add(int x,int v){
for(;x<maxn;bit[x]+=v,x+=x&-x);
}
int sum(int x){
int ret=0;
for(;x>0;ret+=bit[x],x-=x&-x);
return ret;
}
vector<int> g[maxn];
int n,x;
ll ans=0;
int main(){
ios::sync_with_stdio(false);
cin>>n;
rep(i,1,n+1){
cin>>x;
if(x>i) g[i].push_back(x);
else g[x].push_back(i);
}
rep(i,1,n+1){
rep(j,0,g[i].size()){
int v=g[i][j];
ans+=1LL*(sum(v-1)-sum(i));
}
rep(j,0,g[i].size()){
int v=g[i][j];
add(v,1);
}
}
cout<<ans;
return 0;
}
K
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define fi first
#define se second
#define mk(x,y) make_pair(x,y)
const int mod=1e9+7;
const int maxn=1e2+10;
const int ub=1e6;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
int a[9]={2,3,5,7,11,13,17,19,23},n;
ll x;
int solve(ll &x,int y){
rep(i,2,y+1){
if(x%i) return 0;
else x/=i;
}
return 1;
}
int getidx(ll x){
for(int i=7;i>=0;i--) if(x%a[i]==0) return i;
return 0;
}
int dfs(ll x){
if(x==1) return 1;
int idx=getidx(x);
if(solve(x,a[idx])==0) return 0;
if(dfs(x)) return 1;
rep(i,a[idx]+1,a[idx+1]){
if(x%i==0) x/=i;
else break;
if(dfs(x)) return 1;
}
return 0;
}
int main(){
ios::sync_with_stdio(false);
cin>>n;
while(n--){
cin>>x;
ll tmp=x;
rep(i,0,8) while(tmp%a[i]==0) tmp/=a[i];
if(tmp>1) {puts("NO");continue;}
if(dfs(x)) puts("YES");
else puts("NO");
/*
while(x>1){
int idx;
for(idx=7;idx>=0;idx--) if(x%a[idx]==0) break;
if(solve(x,a[idx])==0) {flag=0;break;}
}
if(flag) puts("YES");
else puts("NO");
*/
}
return 0;
}
F
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define fi first
#define se second
#define mk(x,y) make_pair(x,y)
const int mod=1e9+7;
const int maxn=1e2+10;
const int ub=1e6;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
ll x,y;
int n;
int main(){
scanf("%d",&n);
rep(i,0,n){
scanf("%lld%lld",&x,&y);y++;
printf("%.14fn",1.0/x-1.0/y);
}
return 0;
}
G
#include<bits/stdc++.h>
using namespace std;
#define debug puts("YES");
#define rep(x,y,z) for(int (x)=(y);(x)<(z);(x)++)
#define ll long long
#define lrt int l,int r,int rt
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define root l,r,rt
#define mst(a,b) memset((a),(b),sizeof(a))
#define pii pair<int,int>
#define fi first
#define se second
#define mk(x,y) make_pair(x,y)
const int mod=1e9+7;
const int maxn=1e2+10;
const int ub=1e6;
ll powmod(ll x,ll y){ll t; for(t=1;y;y>>=1,x=x*x%mod) if(y&1) t=t*x%mod; return t;}
ll gcd(ll x,ll y){
if(y==0) return x;
return gcd(y,x%y);
}
int n,x,y;
string s,t,ans="";
int main(){
ios::sync_with_stdio(false);
cin>>n>>x>>s>>y>>t;x--;
ans+=s[x];
rep(i,0,y){
if(t[i]=='R') x++;
else x--;
ans+=s[x];
}
cout<<ans;
return 0;
}
最后
以上就是魁梧热狗为你收集整理的Gym 100796题解(个人版的全部内容,希望文章能够帮你解决Gym 100796题解(个人版所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复