結果
問題 |
No.163 cAPSlOCK
|
ユーザー |
![]() |
提出日時 | 2025-03-04 09:02:53 |
言語 | C (gcc 13.3.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 313 bytes |
コンパイル時間 | 1,449 ms |
コンパイル使用メモリ | 24,064 KB |
実行使用メモリ | 8,612 KB |
最終ジャッジ日時 | 2025-03-04 09:02:58 |
合計ジャッジ時間 | 4,714 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 3 |
other | RE * 20 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:21: warning: implicit declaration of function ‘malloc’ [-Wimplicit-function-declaration] 5 | char *str = malloc(101); | ^~~~~~ main.c:3:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’ 2 | #include <ctype.h> +++ |+#include <stdlib.h> 3 | main.c:5:21: warning: incompatible implicit declaration of built-in function ‘malloc’ [-Wbuiltin-declaration-mismatch] 5 | char *str = malloc(101); | ^~~~~~ main.c:5:21: note: include ‘<stdlib.h>’ or provide a declaration of ‘malloc’ main.c:7:19: warning: implicit declaration of function ‘strlen’ [-Wimplicit-function-declaration] 7 | int len = strlen(str); | ^~~~~~ main.c:3:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ 2 | #include <ctype.h> +++ |+#include <string.h> 3 | main.c:7:19: warning: incompatible implicit declaration of built-in function ‘strlen’ [-Wbuiltin-declaration-mismatch] 7 | int len = strlen(str); | ^~~~~~ main.c:7:19: note: include ‘<string.h>’ or provide a declaration of ‘strlen’ main.c:17:26: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ [-Wformat=] 17 | printf("%s",p[i]); | ~^ ~~~~ | | | | | int | char * | %d main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%s",str); | ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <ctype.h> int main(void){ char *str = malloc(101); scanf("%s",str); int len = strlen(str); char *p = str; int ans = 0; for(int i = 0;i< len;i++){ if((p[i] >= 'a') && (p[i] <= 'z')){ str[i] = toupper(str[i]); }else{ p[i] = tolower(p[i]); } printf("%s",p[i]); } }