結果
問題 |
No.3035 文字列のみの反転
|
ユーザー |
![]() |
提出日時 | 2025-03-17 16:34:22 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 379 bytes |
コンパイル時間 | 513 ms |
コンパイル使用メモリ | 24,832 KB |
実行使用メモリ | 7,324 KB |
最終ジャッジ日時 | 2025-03-17 16:34:24 |
合計ジャッジ時間 | 1,765 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%s",str); | ^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> void main(void) { char str[1000] = "a"; scanf("%s",str); int boundary = 0; for(int i = 0 ; str[i] != '\0';i++){ if( 10 > str[i] - '0' && 0 <= str[i] - '0'){ boundary = i; break; } } int i = boundary-1; while(str[i] != '\0'){ printf("%c" ,str[i]); if(i == 0){ i = boundary; }else if(boundary > i){ i--; }else{ i++; } } }