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 3 years have passed since last update.

AtCoder 生活108日目

Posted at

前回

#108日目
今日は、灰色を2問と茶色2問を解きました。

|問題|難易度|自力で解けた|かかった時間|
|:-:|:-:|:-:|---|---|
|AGC046|A|◯|3分2秒|
|ABC179|C|◯|5分35秒|
|ARC093|C|◯|25分20秒|
|ARC080|C|✕|83分42秒|

##AGC046_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 x;
    cin >> x;
    int s = lcm(x,360);
    cout << s/x << endl;
}

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

##ABC179_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;
    int ans = 0;
    for(int i = 1;i < n;i++){
        for(int j = 1;i*j < n;j++)ans++;
    }
    cout << ans << endl;
}

解くのにかかった時間:5分35秒

##ARC093_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;
    int now = 0;
    int ans = 0;
    vector<int> a(n+2);
    a[0] = 0;
    for(int i = 1;i <= n;i++){
        cin >> a[i];
        ans += abs(now - a[i]);
        now = a[i];
    }
    a[n+1] = 0;
    ans += abs(a[n] - a[n+1]);
    for(int i = 1;i <= n;i++){
        int x = abs(a[i] - a[i-1]);
        int y = abs(a[i] - a[i+1]);
        int z = abs(a[i-1] - a[i+1]);
        cout << ans - (x+y) + z << endl;
    }
}

解くのにかかった時間:25分20秒

##ARC080_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 n;
    cin >> n;
    ll odd = 0,q = 0;
    rep(i,n){
        int a;
        cin >> a;
        if(a%2)odd++;
        else if(a%4 == 0)q++;
    }
    bool ok = false;
    if(odd == 0)ok = true;
    else if(odd <= q)ok = true;
    else if(odd + q == n && odd = q+1)ok = true;
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
}

解くのにかかった時間:83分42秒
感想:あと一歩が足りなかった。

###最後に
茶色もなかなか解けるようになってきたような気がする。目標としては30分で解けるようにしていきたい。

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?