28 Aug 2021
λΆν μ 볡 with ππ¨π
#include <iostream>
using namespace std;
int map[130][130];
int b = 0, w = 0;
void sol(int x, int y, int len){
int tmp = 0;
for(int i = x; i < x + len; i++){
for(int j = y; j < y + len; j++){
if(map[i][j]) tmp++;
}
}
if(!tmp) w++;
else if(tmp == len * len) b++;
else{
solution(x, y, len / 2);
solution(x + len / 2, y, len / 2);
solution(x, y + len / 2, len / 2);
solution(x + len / 2, y + len / 2, len / 2);
}
return;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int num;
cin >> num;
for(int i = 1; i <= num; i++){
for(int j = 1; j <= num; j++)
cin >> map[i][j];
}
sol(1, 1, num);
cout << w << "\n";
cout << b << "\n";
return 0;
}
26 Aug 2021
μ ν΄λ¦¬λλ₯Ό μ΄μ©ν μ΅μ곡배μ ꡬνκΈ° λ°©μ! μ΅λ곡μ½μλ₯Ό νμ©νλ€.
#include<iostream>
using namespace std;
int divide(int x, int y) {
if (x%y==0) return y;
else return divide(y, x%y);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int T, A, B;
cin >> T;
for (int i=0; i<T; i++) {
cin >> A >> B;
if (A>=B) {
cout << A*B/divide(A,B) << "\n";
}
else
cout << A*B/divide(B,A) << "\n";
}
return 0;
}
25 Aug 2021
ν λ³ν, μμ€ν€ μ½λ κ΄λ ¨ μμ£Ό κ°λ¨ν λ¬Έμ !π
#include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
char in;
cin >> in;
cout << int(in) << endl;
}

24 Aug 2021
λ²μ κ³ λ €νκΈ°β¦ μ€λ²νλ‘μ° μ‘°μ¬νκΈ°! μ΄λ² κΈ°νμ νΌλ³΄λμΉλ λΉμ·ν νλλλ°μμ΄μ μκ² λμλ€.
Panadovan Sequence
P(n) = P(n-2) + P(n-3)
P(0) = P(1) = P(2) = 1
- ꡬκΈμμ ν΄λΉ μμ΄μ λν μ νμμ μκ² λμκ³ ,
- λ°±μ€ μ§λ¬Έ λ΅λ³μ ν΅ν΄ μ νλ Έλμ§ μ μ μμλ€. =>
int λμ longμ μΌλλ, ν΄κ²°! κΈ°νκΈμμ μΌλ‘ 컀μ§λ μ«μλ₯Ό νμ μ λ
νμβ¦β
#include<iostream>
using namespace std;
long input[101];
long panadovan(int n) {
long ppp = 1, pp = 1, p = 1, pn = 1;
for (int i=3; i<=n; i++) {
pn = ppp+pp;
ppp = pp;
pp = p;
p = pn;
}
return pn;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int T;
cin >> T;
for (int i=0; i<T; i++)
cin >> input[i];
for (int i=0; i<T; i++)
cout << panadovan(input[i]-1) << endl;
return 0;
}

23 Aug 2021
#include<iostream>
using namespace std;
int arr[101];
int get_gcd(int a, int b) {
if (b == 0) return a;
return get_gcd(b, a % b);
}
int main() {
ios::sync_with_stdio(false);
cout.tie(NULL); cin.tie(NULL);
int N, gcd;
cin >> N;
for (int i = 0; i < N; i++) {
cin >> arr[i];
}
for (int i = 1; i < N; i++) {
gcd = get_gcd(arr[0], arr[i]);
cout << arr[0] / gcd << "/" << arr[i] / gcd << endl;
}
return 0;
}
