코드포스5 [코드포스] 129A : Cookies https://codeforces.com/problemset/problem/129/A Problem - 129A - Codeforces codeforces.com //C++ //C++ #include #define F_I ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define pi 3.1415926535 using namespace std; typedef long long ll; int arr[101]; int main() { F_I; ll n, sum = 0, even = 0, odd = 0; cin >> n; for (ll i = 0; i > arr[i]; sum += arr[i]; if (arr[i] % 2 == 0.. 2020. 8. 7. [코드포스] 1283B : Candies Division https://codeforces.com/contest/1283/problem/B Problem - B - Codeforces codeforces.com #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int tc; cin >> tc; for (int i = 0; i > n >> k; int ans = n - n % k; //나올 수 있는 답의 최소 ans += min(n % k, k / 2); cout 문제에 제시된 조건 2개를 만족한다는 가정하에, 최대한 많은 사탕을 나눠줘야 하는 문제이므로 남은 n%k개의 사탕을 최대한 1개씩 아이들에게 각각 .. 2020. 7. 6. [코드포스] 822A : I'm bored with life https://codeforces.com/problemset/problem/822/A Problem - 822A - Codeforces codeforces.com #include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int a, b, ans = 1; cin >> a >> b; for (int i = 1; i 만약 a>b라면, a = 1*2*3*...*b*(b+1)*....a b = 1*2*3*...*b 입니다. 다시 말해, a와 b의 gcd(최대공약수)는 1*2*3*...b가 될 것입니다. 그러므로 1부터 min(a,b)까지의 곱이 답이 되는 것입니다. 2020. 7. 2. [코드포스] 1316A : Grade Allocation https://codeforces.com/problemset/problem/1316/A Problem - 1316A - Codeforces codeforces.com #include using namespace std; //typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int tc; cin >> tc; while (tc--) { int n, m, sum = 0; cin >> n >> m; vector v; for (int i = 0; i > s; sum += s; v.push_back(s); } if (m > sum) cout 2020. 7. 1. [코드포스] 1374A : Required Remainder https://codeforces.com/problemset/problem/1374/A Problem - 1374A - Codeforces codeforces.com #include using namespace std; typedef long long ll; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int tc; cin >> tc; while (tc--) { ll x, y, n; cin >> x >> y >> n; if (((n / x) * x + y) 2020. 6. 30. 이전 1 다음