可以说打的非常失败,咕了
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;
}
D 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;
}
E http://codeforces.com/problemset/problem/805/E
题都没看,待补
待更新——————————————————总结,个人赛太紧张了,要多打比赛才行,哎