結果
| 問題 |
No.18 うーさー暗号
|
| コンテスト | |
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-03 17:56:24 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 402 bytes |
| コンパイル時間 | 250 ms |
| コンパイル使用メモリ | 25,344 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2025-03-03 17:56:26 |
| 合計ジャッジ時間 | 1,059 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 11 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:32: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[10000]’ [-Wformat=]
5 | int inputStr = scanf("%s",&str);
| ~^ ~~~~
| | |
| | char (*)[10000]
| char *
ソースコード
#include <stdio.h>
void main(){
char str[10000] = "a";
int inputStr = scanf("%s",&str);
if(inputStr == 2){
printf("strの入力ミス\n");
}
for(int i = 0 ; i < 10000; i++){
if(str[i] == '\0'){
break;
}
int asciiValue = (int)str[i]-i-1; // キャストを用いて数値に変換
if(asciiValue < (int)'A'){
asciiValue = asciiValue + 26;
}
printf("%c",(char)asciiValue);
}
}
Maeda