結果
| 問題 | No.18 うーさー暗号 | 
| コンテスト | |
| ユーザー |  tsuishi | 
| 提出日時 | 2021-01-08 13:25:52 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 5,000 ms | 
| コード長 | 425 bytes | 
| コンパイル時間 | 1,282 ms | 
| コンパイル使用メモリ | 29,056 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-11-15 18:37:16 | 
| 合計ジャッジ時間 | 1,905 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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);
      |         ^~~~~
            
            ソースコード
#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;
}
            
            
            
        