Language: C++

# 「平成終わるまでにWAしようの会」解説

## 1問目(100)
問題訳
> `a`,`b`の積が偶数ならOdd,奇数ならEvenを出力

問題リンク:[A-Product](https://atcoder.jp/contests/abc086/tasks/abc086_a)

基本的な問題ですね。<br>
偶数奇数の判別方法を知っていれば解くことが可能です。<br>
||偶数|奇数|
|--|--|--|
|`n%2`の結果|0|1|

```cpp
#include<iostream>
using namespace std;
int main(){

    // 入力部
    int a,b;
    cin >> a >> b;

    // 出力部
    if( (a*b)%2 ){
        cout << "Odd" << endl;
    }else{
        cout << "Even" << endl;
    }
    return 0;
}
```

## 2問目(100)
問題訳
> 二つのdateが与えられるのでそれを比較せよ (一つは固定)

問題リンク:[A-StillTBD](https://atcoder.jp/contests/abc119/tasks/abc119_a)

平成も終わりということで年号の問題を持ってきました(笑)。<br>
この問題ですがA問題にしてはなかなか曲者です。<br>
ある程度、文字コードの仕組みについて理解しておく必要がありますし、
Tの文字列の方が大きい場合も考慮しないといけないです。

```cpp
#include<iostream>
#include<string>
using namespace std;
int main(){
    
    //入力部
    string S;
    string T = "2019/04/30"; //平成最後の日
    cin >> S;

    //出力部
    for(int i=0;i<=9;i++){
        if(S[i] < T[i])break; //n文字目が`RE_WA`の方が大きいならループを抜ける
        if(S[i] > T[i]){
            cout << "TBD" << endl;
            return 0;
        } //n文字目が`RE_WA`の方が小さいなら"TBD"を返して処理を終了
    }
    cout << "Heisei" << endl;
    return 0;
}
```

## 3問目(200)
問題訳
> 数列をsortし偶数個目の要素と奇数個目の要素の総和の差を出力せよ

```cpp
#include<iostream>
#include<algorithm>
using namespace std;
int main(){

    //入力部
    int n;
    int a[100];
    for(int i=0;i<n;i++)cin >> a[i];

    //計算部
    sort(a,a+n); //ソート関数でソートします(今回の配列長ならバブルソートでも可)
    int even = 0, odd = 0; //偶数、奇数それぞれの要素の総和を格納する変数を用意
    for(int i=0;i<n;i++){
        if(i%2) odd += a[i]; // 奇数個目の要素なら
        else even += a[i]; // 偶数個目の要素なら
    }
    cout << even-odd << endl;
    return 0;
}
```

Compiler output:
a.cc:1:3: error: extended character 「 is not valid in an identifier
    1 | # 「平成終わるまでにWAしようの会」解説
      |   ^
a.cc:1:3: error: extended character 」 is not valid in an identifier
a.cc:1:3: error: invalid preprocessing directive #\U0000300c\U00005e73\U00006210\U00007d42\U0000308f\U0000308b\U0000307e\U00003067\U0000306bWA\U00003057\U00003088\U00003046\U0000306e\U00004f1a\U0000300d\U000089e3\U00008aac
    1 | # 「平成終わるまでにWAしようの会」解説
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:3:1: error: stray '##' in program
    3 | ## 1問目(100)
      | ^~
a.cc:5:3: error: stray '`' in program
    5 | > `a`,`b`の積が偶数ならOdd,奇数ならEvenを出力
      |   ^
a.cc:5:5: error: stray '`' in program
    5 | > `a`,`b`の積が偶数ならOdd,奇数ならEvenを出力
      |     ^
a.cc:5:7: error: stray '`' in program
    5 | > `a`,`b`の積が偶数ならOdd,奇数ならEvenを出力
      |       ^
a.cc:5:9: error: stray '`' in program
    5 | > `a`,`b`の積が偶数ならOdd,奇数ならEvenを出力
      |         ^
a.cc:9:1: error: extended character 。 is not valid in an identifier
    9 | 基本的な問題ですね。<br>
      | ^
a.cc:10:1: error: extended character 。 is not valid in an identifier
   10 | 偶数奇数の判別方法を知っていれば解くことが可能です。<br>
      | ^
a.cc:13:2: error: stray '`' in program
   13 | |`n%2`の結果|0|1|
      |  ^
a.cc:13:6: error: stray '`' in program
   13 | |`n%2`の結果|0|1|
      |      ^
a.cc:15:1: error: stray '`' in program
   15 | ```cpp
      | ^
a.cc:15:2: error: stray '`' in program
   15 | ```cpp
      |  ^
a.cc:15:3: error: stray '`' in program
   15 | ```cpp
      |   ^
a.cc:32:1: error: stray '`' in program
   32 | ```
      | ^
a.cc:32:2: error: stray '`' in program
   32 | ```
      |  ^
a.cc:32:3: error: stray '`' in program
   32 | ```
      |   ^
a.cc:34:1: error: stray '##' in program
   34 | ## 2問目(100)
      | ^~
a.cc:40:55: error: extended character 。 is not valid in an identifier
   40 | 平成も終わりということで年号の問題を持ってきました(笑)。<br>
      |                                                       ^
a.cc:41:1: error: extended character 。 is not valid in an identifier
   41 | この問題ですがA問題にしてはなかなか曲者です。<br>
      | ^
a.cc:42:1: error: extended character 、 is not valid in an identifier
   42 | ある程度、文字コードの仕組みについて理解しておく必要がありますし、
      | ^
a.cc:42:1: error: extended character 、 is not valid in an identifier
a.cc:43:1: error: extended character 。 is not valid in an identifier
   43 | Tの文字列の方が大きい場合も考慮しないといけないです。
      | ^
a.cc:45:1: error: stray '`' in program
   45 | ```cpp
      | ^
a.cc:45:2: error: stray '`' in program
   45 | ```cpp
      |  ^
a.cc:45:3: error: stray '`' in program
   45 | ```cpp
      |   ^
a.cc:67:1: error: stray '`' in program
   67 | ```
      | ^
a.cc:67:2: error: stray '`' in program
   67 | ```
      |  ^
a.cc:67:3: error: stray '`' in program
   67 | ```
      |   ^
a.cc:69:1: error: stray '##' in program
   69 | ## 3問目(200)
      | ^~
a.cc:73:1: error: stray '`' in program
   73 | ```cpp
      | ^
a.cc:73:2: error: stray '`' in program
   73 | ```cpp
      |  ^
a.cc:73:3: error: stray '`' in program
   73 | ```cpp
      |   ^
a.cc:94:1: error: stray '`' in program
   94 | ```
      | ^
a.cc:94:2: error: stray '`' in program
   94 | ```
      |  ^
a.cc:94:3: error: stray '`' in program
   94 | ```
      |   ^
a.cc:3:4: error: expected unqualified-id before numeric constant
    3 | ## 1問目(100)
      |    ^~~~~
In file included from /usr/include/c++/14/iosfwd:42,
                 from /usr/include/c++/14/ios:40,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:16:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
   68 |   typedef ptrdiff_t     streamsize; // Signed integral type
      |           ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
   40 | #include <cwchar> // For mbstate_t
  +++ |+#include <cstddef>
   41 | 
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
                 from /usr/include/c++/14/exception:166,
                 from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                            ^~~~~~
In file included from /usr/include/wchar.h:35,
                 from /usr/include/c++/14/cwchar:44,
                 from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  132 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
  134 |   __attribute__((__externally_visible__));
      |                                         ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
  140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                             ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
  142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
      |                               ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
  145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                    ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                          ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                              ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
  147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
      |                                                      ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                          ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                            ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
  214 | typedef __SIZE_TYPE__ size_t;
      |                       ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
  154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
      |                                                                    ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
  155 |   __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
      |                                                                         ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                          ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
  156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
      |                                            ^~~~~~
/usr/lib/gcc