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

Posted at

前回

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

|問題|難易度|自力で解けた|かかった時間|
|:-:|:-:|:-:|---|---|
|ABC097|B|◯|34分37秒|
|ABC049|B|◯|2分26秒|
|ARC109|B|✕|182分|

##ABC097_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;

int main(){
    int x;
    cin >> x;
    int ans = 1;
    for(int i = 2;i*i <= x;i++){
        int r = i*i;
        while(r*i <= x){
            r *= i;
        }
        ans = max(ans ,r);
    }
    cout << ans << endl;
}

解くのにかかった時間:34分37秒
感想:i=1の場合にwhileでTLEになることに全然気づけなかった。

##ABC049_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;

int main(){
    int h,w;
    cin >> h >> w;
    rep(i,h){
        string s;
        cin >> s;
        cout << s << endl;
        cout << s << endl;
    }
}

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

##ARC109_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;

int main(){
    ll n;
    cin >> n;
    ll m = sqrt(n+1) + 1;
    while((m + 1)*m/2 <= n+1)m++;
    cout << n - m + 2 << endl;
}

解くのにかかった時間:182分
感想:ある程度考え方は正しかったのにコードをうまくかけなかった。

###最後に
茶色の問題をせめて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?