読者です 読者をやめる 読者になる 読者になる

K^2PC

Welcome to Kyuride Kagamiz Programming Contest (Easy)
- Kyuride Kagamiz Programming Contest (Easy) | AtCoder

時間が無くて出れませんでしたが解いてみました
まだA~Cしかやってません
A : やるだけ

#include <cstdio>
using namespace std;

int a, b, c, d, e, f, g, h, i, num;

int main(){
    scanf("%d %d %d %d", &a, &b, &c, &num);
    d = num; e = num * 2; f = num * 3;
    if(d > a) g = d - a;
    if(e > b) h = e - b;
    if(f > c) i = f - c;
    printf("%d %d %d\n", g, h, i);
    return 0;
}

B : やるだけ

#include <cstdio>
#include <algorithm>
#include <functional>
using namespace std;

int n;
int a[10], crt[7], res[7], fing[10];
char score[100][10];

int main(){
    scanf("%d", &n);
    for(int i = 0; i < 10; i++) scanf("%d", &fing[i]);
    sort(fing, fing + 10, greater<int>());
    for(int i = 0; i < n; i++){
	getchar();
	for(int j = 0; j < 7; j++){
	    scanf("%c", &score[n - 1 - i][j]);
	}
    }
    for(int i = 0; i < n; i++){
	for(int j = 0; j < 7; j++){
	    if(score[i][j] == 'X') crt[j]++;
	    else crt[j] = 0;
	    res[j] = max(res[j], crt[j]);
	}
    }
    sort(res, res + 7, greater<int> ());
    int tmp = 0, posf = 0, posr = 0;
    for(int i = 0; i < 7; i++){
	if(res[posr] <= fing[posf]){
	    posf++; posr++; tmp++;
	}
	else break;
    }
    if(tmp >= 7) printf("YES\n");
    else printf("NO\n");
    return 0;
}

C : 段差想像して段ごとに和が一定だな〜とか思った

#include <cstdio>
using namespace std;

int m, n, sa, sb, sans, res;
int a[2], b[2], ans[2];

int main(){
    scanf("%d %d", &m, &n);
    int tmp = 0;
    while((tmp + 1) * tmp / 2 < m) tmp++;
    a[1] = m - tmp * (tmp - 1) / 2;
    a[0] = tmp + 1 - a[1];
    tmp = 0;
    while((tmp + 1)* tmp / 2 < n) tmp++;
    b[1] = n - tmp * (tmp - 1) / 2;
    b[0] = tmp + 1 - b[1];
    ans[0] = a[0] + b[0];
    ans[1] = a[1] + b[1];
    sans = ans[0] + ans[1] - 1;
    res = sans * (sans - 1) / 2 + ans[1];
    printf("%d\n", res);
    return 0;
}

あとkyuridenamidaさんの歯の神経ぱない