結果

問題 No.18 うーさー暗号
ユーザー tsuishitsuishi
提出日時 2021-01-08 13:25:52
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 425 bytes
コンパイル時間 746 ms
コンパイル使用メモリ 28,612 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-09 20:48:26
合計ジャッジ時間 1,642 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 0 ms
4,380 KB
testcase_03 AC 0 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 0 ms
4,380 KB
testcase_06 AC 0 ms
4,376 KB
testcase_07 AC 0 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 0 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 0 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: 関数 ‘main’ 内:
main.c:2:62: 警告: 関数 ‘strchr’ の暗黙的な宣言です [-Wimplicit-function-declaration]
    2 | #define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
      |                                                              ^~~~~~
main.c:9:9: 備考: in expansion of macro ‘INPUT’
    9 |         INPUT(str);
      |         ^~~~~
main.c:2:1: 備考: include ‘<string.h>’ or provide a declaration of ‘strchr’
    1 | #include <stdio.h>
  +++ |+#include <string.h>
    2 | #define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
main.c:2:62: 警告: 組み込み関数 ‘strchr’ の互換性がない暗黙的な宣言です [-Wbuiltin-declaration-mismatch]
    2 | #define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
      |                                                              ^~~~~~
main.c:9:9: 備考: in expansion of macro ‘INPUT’
    9 |         INPUT(str);
      |         ^~~~~
main.c:2:62: 備考: include ‘<string.h>’ or provide a declaration of ‘strchr’
    2 | #define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
      |                                                              ^~~~~~
main.c:9:9: 備考: in expansion of macro ‘INPUT’
    9 |         INPUT(str);
      |         ^~~~~

ソースコード

diff #

#include <stdio.h>
#define INPUT(str) do{char *p;fgets(str,sizeof(str),stdin);p=strchr(str,'\n');if(p)*p='\0';}while(0)
#define REP1(a,b) for(int a=1;a<=(b);++a)
#define INPBUF (1024+3)
int main(void) {
	char str[INPBUF];
	int	lngt;
	// ready
	INPUT(str);
	// start
	for(lngt=0;str[lngt] != '\0';++lngt);
	REP1(i,lngt) {
		str[i-1] = ( ((str[i-1] - 'A' ) - i % 26 + 26 ) % 26 + 'A' );
	}
	printf("%s\n", str );

	return 0;
}
0