結果
問題 | No.400 鏡 |
ユーザー |
|
提出日時 | 2018-05-20 15:44:04 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,029 bytes |
コンパイル時間 | 120 ms |
コンパイル使用メモリ | 29,952 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 14:41:48 |
合計ジャッジ時間 | 648 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 8 |
ソースコード
#define _GNU_SOURCE#include<stdio.h>#include<string.h>void reverse(char* s) {const size_t l = strlen(s);int start = 0;int end = l - 1;char c;while (start < end) {c = s[start];s[start] = s[end];s[end] = c;start++;end--;}}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);}