cfround586a\b\c

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";
}
/*
Input
4
ezor


Output
0
*/

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;

    }    
}    

 

上一篇:CF798D Mike and distribution


下一篇:soapUI (或curl等工具) 测试 webservice,参数带有 xml 的处理