結果

問題 No.3000 enuemu暗号
ユーザー startcppstartcpp
提出日時 2016-08-14 13:53:01
言語 C++11
(gcc 11.4.0)
結果
OLE  
実行時間 -
コード長 512 bytes
コンパイル時間 436 ms
コンパイル使用メモリ 55,368 KB
実行使用メモリ 10,144 KB
最終ジャッジ日時 2024-04-25 06:35:33
合計ジャッジ時間 18,949 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 OLE -
testcase_01 OLE -
testcase_02 OLE -
testcase_03 OLE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:18: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    6 | char *from[3] = {"pfnovu", "axqwuf", "mbgrihcdejkolsty"};
      |                  ^~~~~~~~
main.cpp:6:28: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    6 | char *from[3] = {"pfnovu", "axqwuf", "mbgrihcdejkolsty"};
      |                            ^~~~~~~~
main.cpp:6:38: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    6 | char *from[3] = {"pfnovu", "axqwuf", "mbgrihcdejkolsty"};
      |                                      ^~~~~~~~~~~~~~~~~~
main.cpp:7:16: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    7 | char *to[3] = {"orange", "cipher", "bqsuftlmdxynzvwj"};
      |                ^~~~~~~~
main.cpp:7:26: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    7 | char *to[3] = {"orange", "cipher", "bqsuftlmdxynzvwj"};
      |                          ^~~~~~~~
main.cpp:7:36: warning: ISO C++ forbids converting a string constant to ‘char*’ [-Wwrite-strings]
    7 | char *to[3] = {"orange", "cipher", "bqsuftlmdxynzvwj"};
      |                                    ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>
#include <iostream>
using namespace std;

char *from[3] = {"pfnovu", "axqwuf", "mbgrihcdejkolsty"};
char *to[3] = {"orange", "cipher", "bqsuftlmdxynzvwj"};

int main() {
	char s[31];
	cin >> s;

	char *p = s;
	bool flag;
	while ('a' <= *p && *p <= 'z') {
		flag = false;
		for (int i = 0; i < 3; i++) {
			for (int j = 0; j < strlen(from[i]); j++) {
				if (*p == from[i][j] && !flag) {
					cout << to[i][j];
					flag = true;
				}
			}
		}
	}
	cout << endl;
	return 0;
}
0