0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AtCoder 生活 91日目

Last updated at Posted at 2020-07-20

前回

91日目

今回は茶色diffの問題を4問解きました。

|問題|難易度|自力で解けた|かかった時間|
|:-:|:-:|:-:|---|---|
|ABC065|C|◯|45分33秒|
|AGC034|A|✕|47分18秒|
|ARC059|C|◯|14分51秒|
|ARC068|C|◯|3分59秒|

ABC065_C


# include <bits/stdc++.h>
# define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

const int INF = 2e9;
const ll mod = 1e9 + 7;

ll f(ll x){
    ll k = 1;
    while(x != 1){
        k = k*x%mod;
        x--;
    }
    return k;
}

int main(){
    ll n,m;
    cin >> n >> m;
    ll t = abs(n-m);
    if(t > 1) cout << 0 << endl;
    else {
        ll a = f(n);
        ll b = f(m);
        ll ans = a*b%mod;
        if(t == 0)cout << ans*2%mod << endl;
        else cout << ans << endl;
    }
}

解くのにかかった時間:45分33秒

AGC034_A


# include <bits/stdc++.h>
# define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

const int INF = 2e9;

int main(){
    int n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    int p = 0;
    for(int i = a;i < max(c,d);i++){
        if(s[i] == '#' && s[i-1] == '#'){
            p++;
            break;
        }
    }
    if(d < c){
        p++;
        for(int i = b;i <= d;i++){
            if(s[i] == '.' && s[i-1] == '.' && s[i-2] == '.'){
                p--;
                break;
            }
        }
    }
    if(p == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
}

解くのにかかった時間:47分18秒
感想:そろそろさっと解ける様になりたい

ARC059_C


# include <bits/stdc++.h>
# define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

const int INF = 2e9;

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll ans = INF;
    for(int i = -100;i <= 100;i++){
        ll sum = 0;
        rep(j,n){
            sum += (a[j] - i) * (a[j] - i);
        }
        ans = min(ans,sum);
    }
    cout << ans << endl;
}

解くのにかかった時間:14分51秒

ARC068_C


# include <bits/stdc++.h>
# define rep(i,n) for(int i = 0;i < (n);i++)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

const int INF = 2e9;

int main(){
    ll x;
    cin >> x;
    ll ans = x/11*2;
    ll res = x%11;
    if(res == 0)cout << ans << endl;
    else if(0 < res && res < 7) cout << ans + 1 << endl;
    else cout << ans + 2 << endl;
}

解くのにかかった時間:3分59秒

最後に

苦手な問題も素早く解けるようになりたい

種類 難易度 かかった平均時間 解けた問題数
ABC C 45分33秒 1問中1問
ARC C 9分25秒 2問中2問
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?