結果

問題 No.455 冬の大三角
ユーザー hotpepsi
提出日時 2016-12-06 00:11:35
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 60,716 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 21:03:03
合計ジャッジ時間 2,464 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 54
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>

using namespace std;
typedef long double LD;

int main(int argc, char *argv[]) {
	int H, W;
	cin >> H >> W;
	string s[100];
	for (int i = 0; i < H; ++i) {
		cin >> s[i];
	}
	bool filled = false;
	for (int c = 1; !filled && c >= 0; --c) {
		for (int i = 0; !filled && i < H; ++i) {
			if (count(s[i].begin(), s[i].end(), '*') == c) {
				for (int j = 0; j < W; ++j) {
					if (s[i][j] != '*') {
						s[i][j] = '*';
						filled = true;
						break;
					}
				}
			}
		}
	}
	for (int i = 0; i < H; ++i) {
		cout << s[i] << endl;
	}
	return 0;
}
0