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

Posted at

前回

#99日目
今日は灰色の問題2問とABC184に参加しました。

|問題|難易度|自力で解けた|かかった時間|
|:-:|:-:|:-:|---|---|
|ABC091|C|◯|40分21秒|
|ABC108|B|✕|46分41秒|

スクリーンショット 2020-11-22 22.48.22.png

##ABC184

###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 a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << a*d - c*b << endl;
}

###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,x;
    cin >> n >> x;
    string s;
    cin >> s;
  
    rep(i,n){
        if(s[i] == 'o')x++;
        else x = max(0,(x-1));
    }
    cout << x << endl;
}

##ABC091_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;
    map<string,ll> cs;
    rep(i,n){
        string s;
        cin >> s;
        cs[s]++;
    }
    ll m;
    cin >> m;
    map<string,ll> ct;
    rep(i,m){
        string s;
        cin >> s;
        ct[s]++;
    }
    ll ans = 0;
    for(auto itr = cs.begin();itr != cs.end();itr++){
        ll sum = cs[itr->first] - ct[itr->first];
        ans = max(ans,sum);
    }
    cout << ans << endl;
}

解くのにかかった時間:40分21秒
感想:mで回すところをnで回していたことに全然気づかなかった…

##ABC108_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 a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << c + (b-d) << " " << d - (a-c) << " ";
    cout << a + (b-d) << " " << b + (c-a); 
}

解くのにかかった時間:46分41秒
感想:無駄にif文で回していた…

###最後に
今日で頭がかなり固くなってきてしまっていることに気がついた
ABC184のC,D問題は今度復習して解けるようにしておきたい。

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?