ぐってぃのプログラミング日記

競技プログラミングやIT関係の記事を書いていくよ

AISing Programming Contest 2019

A問題

A - Bulletin Board

#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   
#include <bitset>
//#include <boost/math/common_factor_rt.hpp>

#define ll long long
#define max 100000
using namespace std;
ll l = 1000000007;

int main()
{
	ll n, h, w;

	cin >> n >> h >> w;

	cout << ((n - h) + 1) * ((n - w) + 1) << endl;
	return 0;
}

B問題

B - Contests
1問目、2問目、3問目に該当する配当をそれぞれ数えて一番小さい値を出力

#include <iostream>
#include <numeric>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <math.h>
#include <cmath>
#include <set>   
#include <bitset>
//#include <boost/math/common_factor_rt.hpp>

#define ll long long
#define max 100000
using namespace std;
ll l = 1000000007;

ll p[100] = {};

int main()
{
	ll n, a, b;
	ll x = 0;
	ll y = 0;
	ll z = 0;


	cin >> n >> a >> b;
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}

	for (int i = 0; i < n; i++)
	{
		if (p[i] <= a) {
			x++;
		}
		else if (a + 1 <= p[i] && p[i] <= b) {
			y++;
		}
		else if (b + 1 <= p[i]) {
			z++;
		}
	}

	cout << min({ x, y, z }) << endl;
	return 0;
	
}

C問題

dfs使うと予想したけど、全くわからず
いつ安定してC問題解けることやら・・・