0
2

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 生活101日目

Last updated at Posted at 2020-11-29

前回

#101日目
今回は灰色diffを3問ときました。

|問題|難易度|自力で解けた|かかった時間|
|:-:|:-:|:-:|---|---|
|ABC055|B|◯|3分35秒|
|ABC100|C|◯|16分44秒|
|ABC144|C|✕|46分41秒|

##ABC055_B


#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 int MOD = 1e9 + 7;

int main(){
    int n;
    cin >> n;
    ll ans = 1;
    rep(i,n){
        ans *= (i+1);
        ans %= MOD;
    }
    cout << ans << endl;
}

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

##ABC100_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 CN(ll n){
    int cnt = 0;
    while(n%2 == 0 && n != 0){
        n /= 2;
        cnt++;
    }
    return cnt;
}

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n)cin >> a[i];
    ll cnt = 0;
    rep(i,n){
        cnt += CN(a[i]);
    }
    cout << cnt << endl;
}

解くのにかかった時間:16分44秒

##ABC144_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 ans = INF;
    ll s,t;
    ll x = sqrt(n);
    for(int i = 1;i < x+1;i++){
        if(n%i == 0){
           s = i; 
        }
    }
    t = n/s;
    cout << t + s - 2 << endl;
}

解くのにかかった時間:42分21秒
感想:全然通らなくて解説見てもアプローチ一緒で自力解決するのにものすごい時間食われた。

###最後に
少しずつだが感覚を取り戻せてきた気がする。次からはもう少し難しめな問題も挑戦していこうかと思う。

0
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?