致一场我没打的CF

\(\color{red}{这场CF我没打~~}\)


\(\color{blue}{所以你写他干嘛???}\)

但是我帮忙代打了2333(大嘘)


\(\color{green}D\)

代码


\(\color{yellow}C\)

code

#include <bits/stdc++.h>
#define maxn 250000
using namespace std ;
int n ,l , r , top ;
char a[maxn] ;
int main () {
	cin >> n ;
	for(int i = 1 ; i <= n ; i ++) {
		cin >> a[i] ;
		if(a[i] == '(') l ++ ;
		else r ++ ; 
	}
	for(int i = 1 ; i <= n ; i ++) {
		if(a[i] == '(' ) top ++ ;
		else top -- ;
		if(top < -1) {
			puts("No") ;
			return 0 ;
		} 
	}
	if(l != r) {
		puts("No") ;
		return 0 ;
	}else puts("Yes") ;
	return 0 ;
} 


\(\color{brown}{B}\)


#include <bits/stdc++.h> 
using namespace std ;
int b , g , n , ans ;
int main() {
	scanf("%d%d%d",&b,&g,&n);
	for(int i = 0 ; i <= n ;i ++) {
		if(i > b)
			break;
		if(n-i > g) 
			continue;
		ans ++ ;
	}
	printf("%d\n" , ans);
	return 0;
}

\(\color{green}{A}\)

#include <bits/stdc++.h> 
using namespace std ;
int n , d , e , t , s[20] ;
bool f[100000005] ;
int dl[10] = {0,1,2,5,10,20,50,100} ;
int el[10] = {0,5,10,20,50,100,200} ;
int main() {
	scanf("%d%d%d",&n,&d,&e);
	for(int i = 1 ;i <= 7 ; i ++)
		s[++t] = d * dl[i] ;
	for(int i = 1 ; i <= 6 ; i ++)
		s[++t] = e * el[i] ;
	f[0] = 1 ;
	for(int i = 1 ; i <= t ; i ++)
		for(int j = s[i] ; j <= n ; j ++)
	    if(f[j-s[i]]) 
	    	f[j] = 1 ;
	for(int i = n ; i >= 0 ; i --) {
		if(f[i] == 1) {
			printf("%d\n",n-i);
			break;
		}
	}
	return 0;
}

溜了溜了

posted @ 2019-09-04 21:33  _L_Y_T  阅读(165)  评论(0编辑  收藏  举报