首页  >  文章  >  数据库  >  Codeforces Round #294 (Div. 2)

Codeforces Round #294 (Div. 2)

WBOY
WBOY原创
2016-06-07 15:44:20853浏览

519A A and B and Chess /*********************************************** * Author: fisty * Created Time: 2015/2/28 21:12:09 * File Name : A.cpp *********************************************** */#include iostream#include cstring#include dequ

519A

A and B and Chess

/***********************************************
 * Author: fisty
 * Created Time: 2015/2/28 21:12:09
 * File Name   : A.cpp
 *********************************************** */
#include <iostream>
#include <cstring>
#include <deque>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <algorithm>
using namespace std;
#define Debug(x) cout  P;
#define FOR(i, a, b) for(int i = a;i > s;
        for(int j = 0;j = 'A'){
                white += _white(s[j]);
            }else if(s[j] = 'a'){
                black += _black(s[j]);
            }
        }
    }
    //Debug(white);
    //Debug(black);
    if(white > black){
        cout 
<table>
<tbody>
<tr>
<td>519B
</td>
<td>
<p>A and B and Compilation Errors
</p>
</td>
</tr>
</tbody>
</table>
A和B 比较,B和C比较。全部排序,遇到第一个不同数字输出并跳出比较<br>
<pre class="brush:php;toolbar:false">/***********************************************
 * Author: fisty
 * Created Time: 2015/2/28 21:43:51
 * File Name   : 294B.cpp
 *********************************************** */
#include <iostream>
#include <cstring>
#include <deque>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <algorithm>
using namespace std;
#define Debug(x) cout  P;
#define FOR(i, a, b) for(int i = a;i > n;
    Memset(a, 0);
    Memset(b, 0);
    Memset(c, 0);
    FOR(i, 0, n){
        cin >> a[i];
    }
    FOR(i, 0, n-1){
        cin >> b[i];
    }
    FOR(i, 0, n-2){
        cin >> c[i];
    }
    sort(a, a + n);
    sort(b, b + n-1);
    sort(c, c + n-2);
    for(int i = 0;i 
<p><br>
</p>
<p>
</p>
<table>
<tbody>
<tr>
<td>519C
</td>
<td>
<p>A and B and Team Training
</p>
</td>
</tr>
</tbody>
</table>
如果n > m 那么采取 n 取两个m 取一个的方案,<br>

<p><br>
</p>
<pre class="brush:php;toolbar:false">/***********************************************
 * Author: fisty
 * Created Time: 2015/2/28 21:54:12
 * File Name   : 294C.cpp
 *********************************************** */
#include <iostream>
#include <cstring>
#include <deque>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <algorithm>
using namespace std;
#define Debug(x) cout  P;
#define FOR(i, a, b) for(int i = a;i > n >> m;
    int ans = 0;
    while(n >= 1 && m >= 1 && m + n >= 3){
        ans++;
        if(n > m){
            n -= 2;
            m--;
        }else{
            m -= 2;
            n--;
        }
    }
    cout <br>
<table>
<tbody>
<tr>
<td>519D
</td>
<td>
<p>A and B and Interesting Substrings
</p>
</td>
</tr>
</tbody>
</table>

<p><strong><span>首先维护前缀和,mp[i][v]表示以字符i结束的前缀和为V出现了几次</span></strong></p>
<p><strong><span>根据题目要求,如果字符u 和 v 中间值为零 那么两者的前缀和相等.<br>
</span></strong></p>
<pre class="brush:php;toolbar:false">/***********************************************
 * Author: fisty
 * Created Time: 2015/2/28 22:46:13
 * File Name   : 294D.cpp
 *********************************************** */
#include <iostream>
#include <cstring>
#include <deque>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
#include <cstdio>
#include <bitset>
#include <algorithm>
using namespace std;
#define Debug(x) cout  P;
#define FOR(i, a, b) for(int i = a;i  mp[MAX_N];
int main() {
    //freopen("in.cpp", "r", stdin);
    cin.tie(0);
    ios::sync_with_stdio(false);
    for(int i = 0;i > a[i];
    }
    cin >> s;
    int n = s.length();
    LL ans = 0;
    LL v = 0;
    for(int i = 0;i <br>
<br>

<br>


</algorithm></bitset></cstdio></vector></string></set></map></list></stack></queue></cmath></deque></cstring></iostream>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn