結果

問題 No.18 うーさー暗号
ユーザー hape8810hape8810
提出日時 2019-01-18 21:14:19
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 338 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 22,528 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 15:05:04
合計ジャッジ時間 951 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |     scanf("%s",S);
      |     ~~~~~^~~~~~~~

ソースコード

diff #

#include <stdio.h>
int main(void){
    char S[1024];
    int i,k,l;
    scanf("%s",S);
    for(i=0;S[i]!='\0';i++){
        k=(i%26)+1;
        l=S[i]-'A';
        if(l<k){
            k=k-l;
            printf("%c",'Z'-k+1);
        }
        else{
            printf("%c",S[i]-k);
        }
    }
    printf("\n");
    
    return 0;
}
0