cfround586ac

Posted 163467wyj

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了cfround586ac相关的知识,希望对你有一定的参考价值。

https://codeforces.com/contest/1220/problem/A

#include<bits/stdc++.h>
using namespace std;
#define ALL(x) ((x).begin(), (x).end())
int main()
    int n; string s;
    cin >> n >> s;
    int c0 = count(s.begin(), s.end(), z);
    int c1 = count(s.begin(), s.end(), n);
    //int c0 = count(ALL(s), ‘z‘);
//    int c0 = count(ALL(s), ‘z‘);//?>??
    //int c1 = count(ALL(s), ‘n‘);
//    int c1 = count(ALL(s), ‘n‘), c0;//????
    
    for (int i = 0; i < c1; ++i)  cout << "1 "; 
    for (int i = 0; i < c0; ++i)  cout << "0 "; 
    cout << "\n";

/*


*/

https://codeforces.com/contest/1220/problem/B

注意溢出, 精度问题

#include<bits/stdc++.h>
 
using namespace std;
#define _for(i,a,b) for(int i = (a); i < (b); i++)
#define _rep(i,a,b) for(int i = (a); i <= (b); i++)
int n, a[1010][1010];
int main()
    cin >> n;
    _rep(i,1,n) _rep(j,1,n)  cin>>a[i][j];
    cout<< (int)sqrt(1LL*a[1][n]*a[1][n-1]/a[n][n-1])<< " " << (int)sqrt(1LL*a[2][1]*a[2][3]/a[1][3]) << " ";
    _rep(i,3,n) cout<< (int)sqrt(1LL*a[i][1]*a[i][2]/a[1][2])<<( i==n?"\n":" ");
    return 0;

/*
4
0 1 1 1000000000
1 0 1 1000000000
1 1 0 1000000000
1000000000 1000000000 1000000000 0
 
Output
1 1 1 1e+009
Answer
1 1 1 1000000000 
*/

 

 

https://codeforces.com/contest/1220/problem/C

其实就是string的每个字符的前置字符是否有  < ch的, 有的话 Ann 直接移动到最小的那个即可胜利, 否则 输

/*
input 
abba

output 
Mike
Ann
Ann
Mike

input 
cba

output 
Mike
Mike
Mike
*/
#include<bits/stdc++.h>
using namespace std;
int main() 
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    char minch = z+1;
    for(char ch : s) 
        if(minch < ch) cout<< "Ann\n";
        else cout<<"Mike\n", minch = ch;

        
    

 

以上是关于cfround586ac的主要内容,如果未能解决你的问题,请参考以下文章

个人训练计划

CFRound #618 div2 C(文末有技巧)

CFround520B.Math,你数学学得咋样啊

直连网线与交叉网线

CF Round 594

codeforces940F题解