結果

問題 No.883 ぬりえ
ユーザー moririn2528_cmoririn2528_c
提出日時 2019-09-13 21:50:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 1,185 bytes
コンパイル時間 815 ms
コンパイル使用メモリ 90,640 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-17 15:28:17
合計ジャッジ時間 2,032 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}

char ca[1005][1005];

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>n>>m;
	a=(n-1)/m+1;
	if(a<=m){
		for(i=1;i<=m;i++){
			if(i*i>=n)break;
		}
		cout<<i<<endl;
		for(j=0;j<i;j++){
			for(k=0;k<i;k++){
				if(j*i+k<n)cout<<'#';
				else cout<<'.';
			}
			cout<<endl;
		}
		return 0;
	}
	cout<<a<<endl;
	for(i=0;i<a;i++){
		for(j=0;j<a;j++){
			ca[i][j]='.';
		}
		ca[i][a]='\0';
	}
	for(i=0,k=0;i<a;i++){
		for(j=0;j<m;j++,k++){
			if(k>=n)break;
			ca[i][k%a]='#';
		}
		cout<<ca[i]<<endl;
	}
}
0