結果

問題 No.18 うーさー暗号
コンテスト
ユーザー Seto
提出日時 2017-01-15 05:17:03
言語 C90
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
WA  
実行時間 -
コード長 203 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 146 ms
コンパイル使用メモリ 37,416 KB
最終ジャッジ日時 2026-02-24 00:06:19
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:6:17: warning: incompatible implicit declaration of built-in function 'strlen' [-Wbuiltin-declaration-mismatch]
    6 |   for(i=0; i <= strlen(s); i++){
      |                 ^~~~~~
main.c:2:1: note: include '<string.h>' or provide a declaration of 'strlen'
    1 | #include<stdio.h>
  +++ |+#include <string.h>
    2 | int main(){
main.c:9:11: warning: passing argument 1 of 'putchar' makes integer from pointer without a cast [-Wint-conversion]
    9 |   putchar("\n");
      |           ^~~~
      |           |
      |           char *
In file included from /usr/include/stdio.h:966,
                 from main.c:1:
/usr/include/x86_64-linux-gnu/bits/stdio.h:82:14: note: expected 'int' but argument is of type 'char *'
   82 | putchar (int __c)
      |          ~~~~^~~

ソースコード

diff #
raw source code

#include<stdio.h>
int main(){	
  char s[1024];
  int i;
  fgets(s, sizeof(s), stdin);
  for(i=0; i <= strlen(s); i++){
    printf("%c", ((s[i] + 26) - (i % 26)) % 26);
  }
  putchar("\n");
  return 0;
}
0