結果

問題 No.883 ぬりえ
ユーザー ExampleExample
提出日時 2019-09-13 21:50:47
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,348 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 116,764 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-09-17 07:10:10
合計ジャッジ時間 3,666 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 RE -
testcase_15 AC 13 ms
4,376 KB
testcase_16 AC 5 ms
4,380 KB
testcase_17 AC 3 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 RE -
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>
#define int long long
#define rep(i, n) for (int i = 0; i < (n); i++)
#define P pair<int, int>
#define sz(x) x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<int>
#define COUT(x) cout<<(x)<<endl
#define MA map<int,int>
#define SE set<int>
#define PQ priority_queue


template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
typedef long long ll;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 50;

// pair -> vector<pair<int,int>> 
//		   AandB.push_back(make_pair(a[i],b[i]))



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	int now = 0;
	int cnt = 0;
	while (true) {
		bool ok = true;
		for (int i = 1; i <= k; i++) {
			now = (cnt/k)*k*k+i * i;
			cnt++;
			if (now >= n) {
				ok = false;
				break;
			}
		}
		if (!ok)break;
	}
	cout << cnt << endl;
	vector<vector<char>>a(cnt, vector<char>(cnt));
	rep(i, cnt) {
		rep(j, cnt) {
			a[i][j] = '.';
		}
	}
	int sharp = 0;
	int tmp = 0;
	bool flag = false;
	rep(i, cnt) {
		for (int j = tmp; j < tmp + k; j++) {
			a[i][j] = '#'; sharp++;
			if (sharp == n) {
				flag = true; break;
			}
		}
		if (flag)break;
		if((i+1)%k==0)tmp += k;
	}
	rep(i, cnt) {
		rep(j, cnt) {
			cout << a[i][j];
		}
		cout << endl;
	}
	return 0;
}
0