結果
| 問題 | No.400 鏡 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-20 15:33:48 |
| 言語 | C++11 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 954 bytes |
| 記録 | |
| コンパイル時間 | 904 ms |
| コンパイル使用メモリ | 40,648 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2026-03-17 11:16:44 |
| 合計ジャッジ時間 | 1,304 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 4 WA * 4 |
コンパイルメッセージ
main.cpp:1:9: warning: '_GNU_SOURCE' redefined
1 | #define _GNU_SOURCE
| ^~~~~~~~~~~
<command-line>: note: this is the location of the previous definition
ソースコード
#define _GNU_SOURCE
#include<stdio.h>
#include<string.h>
void reverse(char* s) {
const size_t l = strlen(s);
for (int i = 0 ; i < l ; i++) {
char t = s[i];
s[i] = s[l-1-i];
s[l-1-i] = s[i];
}
}
void flip(char* s) {
const size_t l = strlen(s);
for (int i = 0 ; i < l ; i++) {
switch (s[i]) {
case '<':
s[i] = '>';
break;
case '>':
s[i] = '<';
break;
default:
break;
}
}
}
void smash_newline(char* s) {
const size_t l = strlen(s);
for (int i = l-1 ; i > 0 ; i--) {
switch(s[i]) {
case '\r':
s[i] = '\0';
break;
case '\n':
s[i] = '\0';
default:
break;
}
}
}
int main(void) {
char s[1025];
fgets(s, 1025, stdin);
smash_newline(s);
flip(s);
reverse(s);
puts(s);
}