結果

問題 No.446 ゆきこーだーの雨と雪 (1)
ユーザー olphe
提出日時 2016-11-18 22:32:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 737 bytes
コンパイル時間 601 ms
コンパイル使用メモリ 53,724 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-26 07:13:35
合計ジャッジ時間 1,028 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 11 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:41: warning: NULL used in arithmetic [-Wpointer-arith]
    9 |         for (int i = 0; letter[0][i] != NULL;i++) {
      |                                         ^~~~
main.cpp:15:41: warning: NULL used in arithmetic [-Wpointer-arith]
   15 |         for (int i = 0; letter[1][i] != NULL; i++) {
      |                                         ^~~~
main.cpp:23:46: warning: NULL used in arithmetic [-Wpointer-arith]
   23 |         if (start[0] == 0 && letter[0][1] != NULL) {
      |                                              ^~~~
main.cpp:27:46: warning: NULL used in arithmetic [-Wpointer-arith]
   27 |         if (start[1] == 0 && letter[1][1] != NULL) {
      |                                              ^~~~

ソースコード

diff #

#include "iostream"
using namespace std;

char letter[2][6];
int start[2];

int main() {
	cin >> letter[1] >> letter[0];
	for (int i = 0; letter[0][i] != NULL;i++) {
		if ((letter[0][i] >= 'a'&&letter[0][i] <= 'z') || (letter[0][i] >= 'A'&&letter[0][i] <= 'Z')) {
			cout << "NG\n";
			return 0;
		}
	}
	for (int i = 0; letter[1][i] != NULL; i++) {
		if ((letter[1][i] >= 'a'&&letter[1][i] <= 'z') || (letter[1][i] >= 'A'&&letter[1][i] <= 'Z')) {
			cout << "NG\n";
			return 0;
		}
	}
	start[0] = letter[0][0] - '0';
	start[1] = letter[1][0] - '0';
	if (start[0] == 0 && letter[0][1] != NULL) {
		cout << "NG\n";
		return 0;
	}
	if (start[1] == 0 && letter[1][1] != NULL) {
		cout << "NG\n";
		return 0;
	}
	cout << "OK\n";
	return 0;
}
0