結果

問題 No.455 冬の大三角
ユーザー HAHAHA
提出日時 2016-12-15 12:57:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 661 bytes
コンパイル時間 1,128 ms
コンパイル使用メモリ 160,472 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-30 08:21:12
合計ジャッジ時間 3,249 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 53 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;


int main(){
	int h,w;
	cin >> h >> w;
	vector<string> s(h);
	
	for(int i=0;i<h;i++){
		cin >> s[i];
	}
	
	int cnt=0;
	bool ok=false;
	if(s[0][0]!='*'){
		for(int i=1;i<w;i++){
			if(s[0][i]=='*') cnt++;
		}
		if(cnt==2)
			s[h-1][w-1]='*';
		else if(cnt==1)
			s[0][0]='*';
		else{
			for(int i=1;i<h;i++){
				if(s[i][i]=='*') ok=true;
				if(s[i][0]=='*') ok=true;
			}
			if(ok) s[0][w-1]='*';
			else s[0][0]='*';
		}
	}
	else{
		for(int i=1;i<w;i++){
			if(s[0][i]=='*') cnt++;
		}
		if(cnt==1)
			s[h-1][w-1]='*';
		else
			s[0][w-1]='*';
	}
	
	
	for(int i=0;i<h;i++){
		cout << s[i] << endl;
	}
	return 0;
}
0