結果
問題 | No.455 冬の大三角 |
ユーザー |
![]() |
提出日時 | 2017-07-27 19:55:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 709 bytes |
コンパイル時間 | 1,260 ms |
コンパイル使用メモリ | 160,136 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-30 01:50:02 |
合計ジャッジ時間 | 2,874 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 54 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 2 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d%d",&H,&W); | ~~~~~^~~~~~~~~~~~~~ main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%s",map[i]); | ~~~~~^~~~~~~~~~~~~ main.cpp:26:26: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 26 | ans: map[y[2]][x[2]] = '*'; | ~~~~~~~~~~~~~~~~^~~~~ main.cpp:3:10: note: at offset -102 into destination object ‘map’ of size 0 3 | char map[101][101]; | ^~~
ソースコード
#include<bits/stdc++.h> main(){ char map[101][101]; int H,W; scanf("%d%d",&H,&W); for(int i = 0;i < H;i++){ scanf("%s",map[i]); } int x[]={-1,-1,-1},y[]={-1,-1,-1}; for(int i = 0;i < H;i++){ for(int j = 0;j < W;j++){ if(map[i][j]=='*'){ x[x[0]==-1?0:1] = j; y[y[0]==-1?0:1] = i; } } } for(int i = 0;i < H;i++){ for(int j = 0;j < W;j++){ if(((x[0]-j)*(y[1]-i))==((x[1]-j)*(y[0]-i)))continue; x[2] = j; y[2] = i; goto ans; } } ans: map[y[2]][x[2]] = '*'; for(int i = 0;i < H;i++){ printf("%s\n",map[i]); } }