結果
| 問題 | No.18 うーさー暗号 |
| コンテスト | |
| ユーザー |
tsuishi
|
| 提出日時 | 2021-01-08 13:25:52 |
| 言語 | C11(gcc12 gnu拡張) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 425 bytes |
| 記録 | |
| コンパイル時間 | 105 ms |
| コンパイル使用メモリ | 32,240 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-08 16:24:40 |
| 合計ジャッジ時間 | 589 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:2:62: warning: implicit declaration of function ‘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: note: in expansion of macro ‘INPUT’
9 | INPUT(str);
| ^~~~~
main.c:2:1: note: 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: warning: incompatible implicit declaration of built-in function ‘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: note: in expansion of macro ‘INPUT’
9 | INPUT(str);
| ^~~~~
main.c:2:62: note: 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: note: in expansion of macro ‘INPUT’
9 | INPUT(str);
| ^~~~~
main.c:2:31: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
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: note: in expansion of macro ‘INPUT’
9 | INPUT(str);
| ^~~~~
ソースコード
#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;
}
tsuishi