[PYTHON] HHKB Programming Contest 2020

Since I did not participate, I described the problem that I solved in 1 hour and 40 minutes

A - Keyboard

Python


S = input()
T = input()
 
if S == 'Y':
  print(str.upper(T))
else:
  print(str.lower(T))

B - Futon

C++


#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<queue>
#include<cmath>
#include<cstdio>
 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define pai 3.1415926535897932384
 
using namespace std;
using ll =long long;
using P = pair<int,int>;
 
int dx[4] = { 0, 1, 0, -1};
int dy[4] = {-1, 0, 1,  0};
char filed[100][100];
 
int main(int argc, const char * argv[]) {
    int H, W;
    cin >> H >> W;
    
    rep(y, H){
        rep(x, W){
            cin >> filed[y][x];
        }
    }
    
    int ans=0;
    rep(y, H){
        rep(x, W){
            if(filed[y][x]=='#') continue;
            
            rep(i, 4){
                int xx = x + dx[i];
                int yy = y + dy[i];
                
                if(xx<0 || W<=xx || yy<0 || H<=yy) continue;
                
                if(filed[yy][xx] =='.') ans++;
            }
        }
    }
    
    cout << ans / 2 << endl;
    
    return 0;
}

C - Neq Min

C++


#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<iomanip>
#include<map>
#include<queue>
#include<cmath>
#include<cstdio>
 
#define rep(i,n) for(int i=0; i<(n); ++i)
#define pai 3.1415926535897932384
 
using namespace std;
using ll =long long;
using P = pair<int,int>;
 
int p[200000];
int pp[200000];
 
int main(int argc, const char * argv[]) {
    int N;
    cin >> N;
    
    rep(i, N){
        cin >> p[i];
    }
    
    int ans=0;
    rep(i, N){
        pp[p[i]]++;
        if(ans == p[i]){
       		while(pp[ans]>0){
        		ans++;
        	}
        }
        cout << ans << endl;
    }
    
    return 0;
}

Recommended Posts

HHKB Programming Contest 2020
HHKB Programming Contest 2020 Review
Notes for HHKB Programming Contest 2020
Acing Programming Contest 2020
AtCoder HHKB Programming Contest 2020 Participation Report
Keyence Programming Contest 2020 Review
After "Diverta 2019 Programming Contest"
Keyence Programming Contest 2021 Notes
NOMURA Programming Contest 2020 Review
Atcoder Acing Programming Contest Python
AtCoder Acing Programming Contest 2020 Participation Report
AtCoder Keyence Programming Contest 2020 Participation Report
AtCoder Panasonic Programming Contest 2020 Participation Report
Poop programming
Sumitomo Mitsui Trust Bank Programming Contest 2019 Review
Graphic programming
Shell programming