結果

問題 No.18 うーさー暗号
コンテスト
ユーザー MaxMellon
提出日時 2015-08-12 19:41:08
言語 C(gnu17)
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -std=gnu17 -Wno-error=implicit-function-declaration -Wno-error=implicit-int -Wno-error=incompatible-pointer-types -Wno-error=int-conversion -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 296 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 174 ms
コンパイル使用メモリ 37,748 KB
最終ジャッジ日時 2026-02-23 19:15:41
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function 'main':
main.c:12:3: warning: implicit declaration of function 'gets'; did you mean 'fgets'? [-Wimplicit-function-declaration]
   12 |   gets(str);
      |   ^~~~
      |   fgets
/usr/bin/ld: /tmp/ccJwiiO9.o: in function `main':
main.c:(.text.startup+0xe): 警告: the `gets' function is dangerous and should not be used.

ソースコード

diff #
raw source code

#include <stdio.h>

#define BUF 1024
#define A 64
#define TYPE 26

int main(int argc, char const* argv[])
{
  char str[BUF];
  int k;

  gets(str);
  for ( k = 1; str[k-1] != '\0'; k++ )
  {
    str[k-1] -= k % TYPE;
    if ( str[k-1] <= A ) { str[k-1] += TYPE; }
  }
  puts(str);

  return 0;
}
0