結果

問題 No.163 cAPSlOCK
ユーザー sasa
提出日時 2025-03-04 09:01:10
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 292 bytes
コンパイル時間 1,641 ms
コンパイル使用メモリ 23,424 KB
実行使用メモリ 8,608 KB
最終ジャッジ日時 2025-03-04 09:01:13
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 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:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |         scanf("%s",str);
      |         ^~~~~~~~~~~~~~~

ソースコード

diff #
プレゼンテーションモードにする

#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]);
}
}
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0