个人赛NO.1(Codeforces Round #411 (Div. 2)A,B,C,D,E,hdu1356)

可以说打的非常失败,咕了

A  A. Fake NP

http://codeforces.com/problemset/problem/805/A


//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<cstring>
#include<limits.h>
using namespace std;
typedef long long ll;
const ll INF=LONG_LONG_MAX;
const ll inf=LONG_LONG_MIN;
ll le,ri;
int main() {
	scanf("%lld%lld",&le,&ri);
	if(le==ri) {
		printf("%lld\n",le);
	} else {
		printf("2\n");
	}
	return 0;
}

交了6法不谈了

B  B. 3-palindrome

http://codeforces.com/problemset/problem/805/B


//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<cstring>
#include<limits.h>
using namespace std;
typedef long long ll;
const ll INF=LONG_LONG_MAX;
const ll inf=LONG_LONG_MIN;
ll n;
int main() {
	scanf("%lld",&n);
	vector<char> arr(n);
	bool flaga = 1;
	bool flagb = 0;
	for (int i = 0; i < n;) {
		if (flaga) {
			arr[i] = 'a';
			i++;
			if (i < n) arr[i] = 'a';
			i++;
			flaga = 0;
			flagb = 1;
		} else { 
			arr[i] = 'b';
			i++;
			if (i < n) arr[i] = 'b';
			i++;
			flaga = 1;
			flagb = 0;
		}
	}
	for(int i=0; i<n; ++i) {
		cout<<arr[i];
	}
	cout<<endl;
	return 0;
}

一开始一直re,真的已经心态蹦了

C C. Find Amir

http://codeforces.com/problemset/problem/805/C

虽然放在C题,但还是很简单的,随便推一下就行了


//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<cstring>
#include<limits.h>
using namespace std;
typedef long long ll;
const ll INF=LONG_LONG_MAX;
const ll inf=LONG_LONG_MIN; 
ll n;
int main(){
	scanf("%lld",&n);
	if(n%2==0){
		cout<<(n/2-1)<<endl;
	}	
	else{
		cout<<n/2<<endl;
	}
	
	return 0;
}

http://acm.hdu.edu.cn/showproblem.php?pid=1356

初步看了一下是扩展欧几里德,但没有做出来,待补

撸完了题解感觉比E难多了,https://blog.csdn.net/TDD_Master/article/details/83958544

 

E D. Minimum number of steps

http://codeforces.com/problemset/problem/805/D

推到出来,但因为没有取模,而wa 确实了,太心急

#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<cstring>
#include<limits.h>
using namespace std;
typedef long long ll;
const ll INF=LONG_LONG_MAX;
const ll inf=LONG_LONG_MIN;
string s;
ll mmod=1e9+7;
ll mod_pow(ll x,ll n,ll mod) {
	ll res=1;
	while(n>0) {
		if(n&1)
			res=res*x%mod;
		x=x*x%mod;
		n>>=1;
	}
	return res;
}
int main() {
	cin>>s;
	ll numa=0,numb=0,res=0;
	for(int i=0; i<s.size();) {
		if(s[i]=='b'&&numa!=0) {
			int j;
			for(j=i; j<s.size(); ++j) {
				if(s[j]=='a') {
					break;
				}
			}
			ll numb=j-i;
			i=j;
			ll tmp=(numb*(mod_pow(2,numa,mmod)-1));
			res=(res+tmp) %mmod;
		} else {
			if(s[i]=='a') {
				numa++;
			}
			++i;
		}
	}
	cout<<res%mmod<<endl;
	return 0;
}

 

http://codeforces.com/problemset/problem/805/E

题都没看,待补

 

 

待更新——————————————————总结,个人赛太紧张了,要多打比赛才行,哎

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值