提出 #583558
ソースコード 拡げる
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))
#define rep(i, n) FOR(i, 0, n - 1)
#define rep1(i, n) FOR(i, 1, n)
#define rrep(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define all(a) (a).begin(),(a).end()
#define PB push_back
using namespace std;
using ll = long long int;
using vb = vector<bool>;
using vi = vector<int>;
using vd = vector<double>;
using vll = vector<ll>;
using vvb = vector<vb>;
using vvi = vector<vi>;
using vvd = vector<vd>;
using vvll = vector<vll>;
using vvvi = vector<vvi>;
using vvvd = vector<vvd>;
// using P = pair<int, int>;
const int INF = 0x7fffffff;
const ll divisor = 1000000007;
int main(){
string S;
cin >> S;
int L = S.size();
string ans = "";
int exc = 0;
int dash = 0;
rep(i, L){
if(S[i] == '!') exc++;
else if(exc == 0) dash++;
}
if(dash % 2 == 1) ans += "-";
if(exc > 0 && exc % 2 == 1) ans += "!";
else if(exc > 0 && exc % 2 == 0) ans += "!!";
cout << ans << endl;
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | E - ショートコーディング |
| ユーザ | pione30 |
| 言語 | C++11 (GCC 4.9.2) |
| 得点 | 100 |
| コード長 | 1035 Byte |
| 結果 | AC |
| 実行時間 | 29 ms |
| メモリ | 928 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 100 / 100 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | sample-01.txt, sample-02.txt, sample-03.txt |
| All | sample-01.txt, sample-02.txt, sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt, 01-27.txt, 01-28.txt, 01-29.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01-01.txt | AC | 28 ms | 804 KiB |
| 01-02.txt | AC | 26 ms | 800 KiB |
| 01-03.txt | AC | 27 ms | 920 KiB |
| 01-04.txt | AC | 26 ms | 800 KiB |
| 01-05.txt | AC | 28 ms | 928 KiB |
| 01-06.txt | AC | 26 ms | 920 KiB |
| 01-07.txt | AC | 29 ms | 792 KiB |
| 01-08.txt | AC | 28 ms | 792 KiB |
| 01-09.txt | AC | 27 ms | 804 KiB |
| 01-10.txt | AC | 27 ms | 920 KiB |
| 01-11.txt | AC | 27 ms | 924 KiB |
| 01-12.txt | AC | 26 ms | 924 KiB |
| 01-13.txt | AC | 27 ms | 788 KiB |
| 01-14.txt | AC | 27 ms | 928 KiB |
| 01-15.txt | AC | 28 ms | 920 KiB |
| 01-16.txt | AC | 28 ms | 920 KiB |
| 01-17.txt | AC | 27 ms | 916 KiB |
| 01-18.txt | AC | 27 ms | 748 KiB |
| 01-19.txt | AC | 26 ms | 920 KiB |
| 01-20.txt | AC | 27 ms | 736 KiB |
| 01-21.txt | AC | 27 ms | 804 KiB |
| 01-22.txt | AC | 29 ms | 800 KiB |
| 01-23.txt | AC | 26 ms | 920 KiB |
| 01-24.txt | AC | 28 ms | 920 KiB |
| 01-25.txt | AC | 29 ms | 924 KiB |
| 01-26.txt | AC | 29 ms | 732 KiB |
| 01-27.txt | AC | 26 ms | 920 KiB |
| 01-28.txt | AC | 28 ms | 924 KiB |
| 01-29.txt | AC | 28 ms | 800 KiB |
| sample-01.txt | AC | 26 ms | 800 KiB |
| sample-02.txt | AC | 28 ms | 736 KiB |
| sample-03.txt | AC | 28 ms | 844 KiB |