-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
217 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
using ull = unsigned long long; | ||
using ll = long long; | ||
using vi = vector<int>; | ||
using vl = vector<long>; | ||
using vll = vector<long long>; | ||
using vvi = vector<vi>; | ||
using vvl = vector<vl>; | ||
using vvll = vector<vll>; | ||
using vs = vector<string>; | ||
using pii = pair<int, int>; | ||
#define REP(i,n) for(int i=0; i<(n); i++) | ||
#define REP2(i,x,n) for(int i=x; i<(n); i++) | ||
#define ALL(n) begin(n),end(n) | ||
#define PRINT(n) cout << n << endl; | ||
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; | ||
const long long INF = numeric_limits<long long>::max(); | ||
int main() | ||
{ | ||
ll a, b, c; | ||
cin >> a >> b >> c; | ||
ll a_half =0, b_half = 0, c_half = 0, count = 0; | ||
if(a == 1 || b == 1 || c == 1){ | ||
PRINT(0) | ||
return 0; | ||
}else if(a == b && b == c){ | ||
PRINT(-1) | ||
return 0; | ||
} | ||
while(a % 2 == 0 && b % 2 == 0 && c % 2 == 0){ | ||
//手持ちの半分の値をそれぞれ保存 | ||
a_half = a / 2; | ||
b_half = b / 2; | ||
c_half = c / 2; | ||
//a, b, cを0に初期化 | ||
a = 0; b = 0; c = 0; | ||
//手持ちの半分の値をそれぞれに追加 | ||
a = b_half + c_half; | ||
b = a_half + c_half; | ||
c = a_half + b_half; | ||
count++; | ||
} | ||
PRINT(count) | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
using ull = unsigned long long; | ||
using ll = long long; | ||
using vi = vector<int>; | ||
using vl = vector<long>; | ||
using vll = vector<long long>; | ||
using vvi = vector<vi>; | ||
using vvl = vector<vl>; | ||
using vvll = vector<vll>; | ||
using vs = vector<string>; | ||
using pii = pair<int, int>; | ||
#define REP(i,n) for(int i=0; i<(n); i++) | ||
#define REP2(i,x,n) for(int i=x; i<(n); i++) | ||
#define ALL(n) begin(n),end(n) | ||
#define PRINT(n) cout << n << endl; | ||
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; | ||
const long long INF = numeric_limits<long long>::max(); | ||
int main() | ||
{ | ||
string N, K; | ||
cin >> N >> k; | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
using ull = unsigned long long; | ||
using ll = long long; | ||
using vi = vector<int>; | ||
using vl = vector<long>; | ||
using vll = vector<long long>; | ||
using vvi = vector<vi>; | ||
using vvl = vector<vl>; | ||
using vvll = vector<vll>; | ||
using vs = vector<string>; | ||
using pii = pair<int, int>; | ||
#define REP(i,n) for(int i=0; i<(n); i++) | ||
#define REP2(i,x,n) for(int i=x; i<(n); i++) | ||
#define ALL(n) begin(n),end(n) | ||
#define PRINT(n) cout << n << endl; | ||
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; | ||
const long long INF = numeric_limits<long long>::max(); | ||
int main() | ||
{ | ||
int k; | ||
cin >> k; | ||
int hour = k / 60; | ||
int min = k % 60; | ||
if(min < 10) cout << 21 + hour << ":" << 0 << min << endl; | ||
else cout << 21 + hour << ":" << min << endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
#include <bits/stdc++.h> | ||
using namespace std; | ||
using ull = unsigned long long; | ||
using ll = long long; | ||
using vi = vector<int>; | ||
using vl = vector<long>; | ||
using vll = vector<long long>; | ||
using vvi = vector<vi>; | ||
using vvl = vector<vl>; | ||
using vvll = vector<vll>; | ||
using vs = vector<string>; | ||
using pii = pair<int, int>; | ||
#define REP(i,n) for(int i=0; i<(n); i++) | ||
#define REP2(i,x,n) for(int i=x; i<(n); i++) | ||
#define ALL(n) begin(n),end(n) | ||
#define PRINT(n) cout << n << endl; | ||
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star; | ||
const long long INF = numeric_limits<long long>::max(); | ||
int main() | ||
{ | ||
int n, max_num = 0; | ||
pii ij, ij_2; | ||
cin >> n; | ||
vs S(n); | ||
vector<vll> A(n, vll(n)); | ||
REP(i, n) cin >> S[i]; | ||
REP(i, n){ | ||
REP(j, n){ | ||
A[i][j] = (int)(S[i].at(j) - '0'); | ||
if(max_num < A[i][j]){ | ||
max_num = A[i][j]; | ||
ij.first = i; | ||
ij.second = j; | ||
} | ||
} | ||
} | ||
max_num = 0; | ||
REP2(i, -1, 2){ | ||
REP2(j, -1, 2){ | ||
if(ij.first + i != ij.first && ij.second + j != ij.second){ | ||
if((ij.first + i) >=n && (ij.second + j) >= n){ | ||
if(max_num < A[ij.first + i - n][ij.second + j - n]){ | ||
max_num = A[ij.first + i - n][ij.second + j - n]; | ||
ij_2.first = ij.first + i - n; | ||
ij_2.second = ij.second + j - n; | ||
} | ||
|
||
} | ||
else if((ij.second + j) < 0 && (ij.first + i) < 0 ){ | ||
if(max_num < A[ij.first + i + n][ij.second + j + n]){ | ||
max_num = A[ij.first + i + n][ij.second + j + n]; | ||
ij_2.first = ij.first + i + n; | ||
ij_2.second = ij.second + j + n; | ||
} | ||
|
||
} | ||
else if((ij.first + i) >=n){ | ||
if(max_num < A[ij.first + i - n][ij.second + j]){ | ||
max_num = A[ij.first + i - n][ij.second + j]; | ||
ij_2.first = ij.first + i - n; | ||
ij_2.second = ij.second + j; | ||
} | ||
|
||
}else if((ij.second + j) >= n){ | ||
if(max_num < A[ij.first + i][ij.second + j - n]){ | ||
max_num = A[ij.first + i][ij.second + j - n]; | ||
ij_2.first = ij.first + i; | ||
ij_2.second = ij.second + j - n; | ||
} | ||
|
||
}else if((ij.first + i) < 0 ){ | ||
if(max_num < A[ij.first + i + n][ij.second + j]){ | ||
max_num = A[ij.first + i][ij.second + j]; | ||
ij_2.first = ij.first + i + n; | ||
ij_2.second = ij.second + j; | ||
} | ||
|
||
}else if((ij.second + j) < 0 ){ | ||
if(max_num < A[ij.first + i][ij.second + j + n]){ | ||
max_num = A[ij.first + i][ij.second + j + n]; | ||
ij_2.first = ij.first + i; | ||
ij_2.second = ij.second + j + n; | ||
} | ||
|
||
}else if(max_num < A[ij.first + i][ij.second + j]){ | ||
max_num = A[ij.first + i][ij.second + j]; | ||
ij_2.first = ij.first + i; | ||
ij_2.second = ij.second + j; | ||
|
||
} | ||
} | ||
} | ||
} | ||
vll ans(n); | ||
ans[0] = A[ij.first][ij.second]; | ||
ans[1] = A[ij_2.first][ij_2.second]; | ||
int i_diff = ij_2.first - ij.first; | ||
int j_diff = ij_2.second - ij.second; | ||
if(i_diff < -1) i_diff += n; | ||
else if(j_diff < -1) j_diff += n; | ||
else if(i_diff > 1) i_diff -= n; | ||
else if(j_diff > 1) j_diff -= n; | ||
REP(i, n-2){ | ||
|
||
if (i_diff*(i+1) + ij_2.first >= n && j_diff*(i+1) + ij_2.second >= n) ans[i+2] = A[(i_diff*(i+1) + ij_2.first) % n][(j_diff*(i+1) + ij_2.second) % n]; | ||
else if(i_diff*(i+1) + ij_2.first < 0 && j_diff*(i+1) + ij_2.second <0) ans[i+2] = A[i_diff*(i+1) + ij_2.first + n][j_diff*(i+1) + ij_2.second + n]; | ||
else if(i_diff*(i+1) + ij_2.first >= n) ans[i+2] = A[(i_diff*(i+1) + ij_2.first) % n][j_diff*(i+1) + ij_2.second]; | ||
else if(j_diff*(i+1) + ij_2.second >= n) ans[i+2] = A[i_diff*(i+1) + ij_2.first][(j_diff*(i+1) + ij_2.second) % n]; | ||
else if(i_diff*(i+1) + ij_2.first < 0) ans[i+2] = A[i_diff*(i+1) + ij_2.first + n][j_diff*(i+1) + ij_2.second]; | ||
else if(j_diff*(i+1) + ij_2.second < 0) ans[i+2] = A[i_diff*(i+1) + ij_2.first][j_diff*(i+1) + ij_2.second + n]; | ||
else ans[i+2] = A[i_diff*(i+1) + ij_2.first][j_diff*(i+1) + ij_2.second]; | ||
|
||
} | ||
REP(i, n) cout << ans[i]; | ||
cout << endl; | ||
|
||
return 0; | ||
} |