結果
問題 | No.9006 マルチバイト文字テスト(テスト用) |
ユーザー | T.Myze |
提出日時 | 2015-04-13 00:17:37 |
言語 | C90 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 479 bytes |
コンパイル時間 | 904 ms |
コンパイル使用メモリ | 24,380 KB |
実行使用メモリ | 4,500 KB |
最終ジャッジ日時 | 2023-09-17 19:50:14 |
合計ジャッジ時間 | 1,322 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
コンパイルメッセージ
main.c: In function ‘main’: main.c:11:2: warning: implicit declaration of function ‘gets’; did you mean ‘fgets’? [-Wimplicit-function-declaration] gets(str); ^~~~ fgets main.c: In function ‘invert_str’: main.c:26:15: warning: implicit declaration of function ‘calloc’ [-Wimplicit-function-declaration] ans = (char*)calloc(n + 1, sizeof(char)); ^~~~~~ main.c:26:15: warning: incompatible implicit declaration of built-in function ‘calloc’ main.c:26:15: note: include ‘<stdlib.h>’ or provide a declaration of ‘calloc’ main.c:3:1: +#include <stdlib.h> main.c:26:15: ans = (char*)calloc(n + 1, sizeof(char)); ^~~~~~ main.c:34:2: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration] free(ans); ^~~~ main.c:34:2: warning: incompatible implicit declaration of built-in function ‘free’ main.c:34:2: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’ /tmp/cc8riEdI.o: In function `main': main.c:(.text.startup+0x1d): warning: the `gets' function is dangerous and should not be used.
ソースコード
#include <stdio.h> #include <string.h> void invert_str(char *str,int n); int main(void){ char str[1000]; int n = 0; printf("Input string->"); gets(str); n = strlen(str); invert_str(str, n); return 0; } void invert_str(char *str,int n){ char *ans; int i,j; ans = (char*)calloc(n + 1, sizeof(char)); ans[n] = '\0'; for (i = n - 1, j = 0; i > -1; i--,j++){ ans[i] = str[j]; //printf("%c", str[i]); } printf("Inverted string->%s\n", ans); free(ans); }