AtCoder Beginner Contest 238

##[A - Exponential or Quadratic](https://atcoder.jp/contests/abc238/tasks/abc238_a)

O(1)

```C++:C++
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define repx(i,x,n) for(int i=x; i<(n); ++i)
#define fixed_setprecision(n) fixed << setprecision((n))
#define execution_time(ti) printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
#define pai 3.1415926535897932384
#define NUM_MAX 2e18
#define NUM_MIN -1e9
 
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

int main() {
    ll n;
    cin >> n;

    if(powl(2, n) > n*n) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}
```

##[B - Pizza](https://atcoder.jp/contests/abc238/tasks/abc238_b)

O(N)
入力で与えられた角度を、累積和の手法で加算していきます。
その後、加算された角度を３６０で割った余りにします。
最後の角度と３６０との角度を追加します。
一番大きな角度を計測します。

```C++:C++
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define repx(i,x,n) for(int i=x; i<(n); ++i)
#define fixed_setprecision(n) fixed << setprecision((n))
#define execution_time(ti) printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
#define pai 3.1415926535897932384
#define NUM_MAX 2e18
#define NUM_MIN -1e9
 
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    vector<int> AA;
    AA.push_back(0);
    rep(i, N) AA.push_back(A[i] + AA[i]);
    rep(i, AA.size()) AA[i] = AA[i] % 360;

    sort(AA.begin(), AA.end());

    int ans = 0;
    rep(i, AA.size()-1){
        ans = max(ans, AA[i+1] - AA[i]);
    }
    
    ans = max(360-AA[AA.size()-1], ans);
    cout << ans << endl;

    return 0;
} 
```

##[C - digitnum](https://atcoder.jp/contests/abc238/tasks/abc238_c)

O(N)

```C++:C++
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define repx(i,x,n) for(int i=x; i<(n); ++i)
#define fixed_setprecision(n) fixed << setprecision((n))
#define execution_time(ti) printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
#define pai 3.1415926535897932384
#define NUM_MAX 2e18
#define NUM_MIN -1e9
 
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

ll amari = 998244353;

int main() {
    ll N;
    cin >> N;
    string s = to_string(N);
    ll n = s.size();
    ll p10 = 10;
    ll ans=0;
    for(ll i=0; i<n; i++){
        ll l = p10 / 10;
        ll r = min(N, p10-1);
        ll t = (r-l+1) % amari;
        ll tt = t*(t+1)/2 % amari;
        ans = (ans+tt) % amari;
        p10*=10;
    }
    cout << ans << endl;

    return 0;
} 
```

##[D - AND and SUM](https://atcoder.jp/contests/abc238/tasks/abc238_d)

O(N)

```C++:C++
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define repx(i,x,n) for(int i=x; i<(n); ++i)
#define fixed_setprecision(n) fixed << setprecision((n))
#define execution_time(ti) printf("Execution Time: %.4lf sec\n", 1.0 * (clock() - ti) / CLOCKS_PER_SEC);
#define pai 3.1415926535897932384
#define NUM_MAX 2e18
#define NUM_MIN -1e9
 
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmax(T& a, T b){ if(a<b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b){ if(a>b){ a=b; return 1; } return 0; }

int main() {
    int T;
    cin >> T;

    vector<ll> a(T), s(T);
    rep(i, T) cin >> a[i] >> s[i];

    rep(i, T){
        ll d = s[i] - 2*a[i];
        string ans="No";
        if(d>=0) if((d&a[i])==0) ans="Yes";
        cout << ans << endl;
    }

    return 0;
} 
```