Since I did not participate, I described the problem that I solved in 1 hour and 40 minutes
Python
S = input()
T = input()
if S == 'Y':
print(str.upper(T))
else:
print(str.lower(T))
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++
#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