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

Last updated at Posted at 2020-10-15

前回

96日目

今回はABC179のA〜C問題をときました。

|問題|難易度|自力で解けた|かかった時間|
|:-:|:-:|:-:|---|---|
|ABC179|A|◯|2分59秒|
|ABC179|B|◯|3分59秒|
|ABC179|C|◯|10分38秒|

ABC179

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(){
    string s;
    cin >> s;
    int m =s.length() - 1;
    if(s[m] == 's') cout << s << "es" << endl;
    else cout << s << "s" << endl;
}

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

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 n;
    cin >> n;
    int cnt = 0;
    rep(i,n){
        int a,b;
        cin >> a >> b;
        if(a == b)cnt++;
        else cnt = 0;
        if(cnt == 3){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

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

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

解くのにかかった時間:10分38秒

最後に

最近全探索の存在を忘れかけていたのでC問題がちょうどよかった。

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?