Codeforces Round #585 (Div. 2) A,B,C,D

Topic link: https: //codeforces.com/contest/1215

 

 

 

 

                        Topic: A

 

 

 

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<ctime>
 4 #include<cstring>
 5 #include<cstdlib>
 6 #include<cmath>
 7 #include<queue>
 8 #include<stack>
 9 #include<map> 
10 #include<algorithm>
11 #define Max(a,b) ((a)>(b)?(a):(b))
12 #define Min(a,b) ((a)<(b)?(a):(b))
13 #define Mem0(x) memset(x,0,sizeof(x))
14 #define Mem1(x) memset(x,-1,sizeof(x))
15 #define MemX(x) memset(x,0x3f,sizeof(x))
16 using namespace std;
17 typedef long long ll;
18 const int inf=0x3f3f3f;
19 const double pi=acos(-1.0);
20 
21 int main()
22 {
23     int a1,a2,k1,k2,n,min1=0,max2=0;
24     cin>>a1>>a2>>k1>>k2>>n; 
25     int p=a1*k1+a2*k2-a1-a2;
26     if (n>p){
27         min1=n-P;
 28          IF (MIN1> = A1 + A2) {
 29              MIN1 = A1 + A2; 
 30          }
 31 is      }
 32      IF (K1 <K2) { //    ensure that the first team penalty next person needs more Yellow 
33 is          int T;
 34 is          T = K1; K1 = K2; K2 = T;
 35          T = A1; A1 = A2; A2 = T;
 36      }    
 37 [      int tmp = n-, TEMP = n-/ K2;
 38 is      IF (TEMP> = A2 && tmp> 0 ) { // all in 
39          tmp = tmp * K2- A2;
 40          MAX2 = MAX2 +a2;
41         if (tmp>=k1){
42             temp=tmp/k1;
43             max2=max2+min(temp,a1);
44         } 
45     }
46     else if (temp<a2&&tmp>0){ //部分下 
47 
48         max2=max2+temp;
49     }
50     cout<<min1<<" "<<max2<<endl;
51     return 0;
52 }

 

                         Topic: B

 

 

 

 

 

 

 

 

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<ctime>
 4 #include<cstring>
 5 #include<cstdlib>
 6 #include<cmath>
 7 #include<queue>
 8 #include<stack>
 9 #include<map> 
10 #include<algorithm>
11 #define Max(a,b) ((a)>(b)?(a):(b))
12 #define Min(a,b) ((a)<(b)?(a):(b))
13 #define Mem0(x) memset(x,0,sizeof(x))
14 #define Mem1(x) memset(x,-1,sizeof(x))
15 #define MemX(x) memset(x,0x3f,sizeof(x))
16 using namespace std;
17 typedef long long ll;
18 const int inf=0x3f3f3f;
19 const double pi=acos(-1.0);
20 
21 int main()
22 {
23     ll n,x,a=0,b=1,tmp=1;
24     scanf("%lld",&n);
25     for (ll i=1;i<=n;i++){
26         scanf("%lld",&x);
27         if (x<0)
28             tmp*=-1;
29         if (tmp<0)
30             a++;
31         else
32             b++;
33     }
34     printf("%lld %lld\n",a*b,(n+1)*n/2-a*b);
35     return 0;
36 }

 

 

 

 

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/q1204675546/p/11567879.html