Codeforces Round #548(Div.2)(3문제 부족~)

1466 단어 Codeforces
A. Even Substrings
#include
using namespace std;
int main(){
	int n;
	scanf("%d",&n);
	string s;
	cin>>s;
	long long ans=0;
	for(int i=0;i

 B. Chocolates
#include
using namespace std;
int a[200005];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=0;i=0;--i){
		if(a[i+1]-1>=a[i]) ans+=a[i];
		else a[i]=max(a[i+1]-1,0),ans+=a[i];
	}
	printf("%lld",ans);
}

C. Edgy Trees
#include
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int MAXV=100005;
vectoradj[MAXV];
int n;//n    ,MAXV       
bool vis[MAXV];//    i    , vis[i]=true.   false

ll poww(ll a, ll b){
    ll ans = 1, base = a;
    while(b>0){
        if(b&1) ans*=base,ans%=MOD; 
        base*=base,base%=MOD;
        b>>=1; //b=b/2
    }
    return ans%MOD;
}

int main(){
	int k;
	scanf("%d%d",&n,&k);
	int u,v,color;
	ll cnt=0,num=0,sum=0;
	for(int i=0;iq;
			if(!vis[i]){//   
				q.push(i);
				vis[i]=true;
			}
			while(!q.empty()){
				int top=q.front();
				q.pop();
				for(int j=0;j

좋은 웹페이지 즐겨찾기