Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;

int n, m, k;
int main() {
cin >> n >> m >> k;
k -= 3; m += k;
m %= n;
if (m == 0) {
m = n;
}
if (m < 0) {
m = n + m;
}
cout << m;
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;


int main() {
int res = 1;
int n; cin >> n;
for (int i = 1; i <= n; i++) {
res *= i;
}
cout << res;
}


Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;


int main() {
int n, m; cin >> n >> m;
int a[1001] = {}, b[1001] = {};
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 0; i < m; i++) {
cin >> b[i];
}
int mx = -1e9;
for (int i = 0; i < max(n, m); i++) {
mx = max(b[i] - a[i], mx);
}
cout << (mx < 0 ? 0 : mx);
}


48 changes: 48 additions & 0 deletions Codeforces/(2022.05.23) ECR_129/(A) Game with Cards/CF129_A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define endl "\n"
#define pii pair<int,int>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define fs first
#define sc second
#define ll long long
#define np(v) while(next_permutation(v.begin(),v.end()))
using namespace std;

int n, m, t;
int k;
int tmp = 0;
int main() {
fastio;
vector<int>a; vector<int>b;
cin >> t;
while (t--) {
a.clear(); b.clear();
cin >> n;
for (int i = 0; i < n; i++) {
cin >> k;
a.push_back(k);
}
cin >> m;
for (int i = 0; i < m; i++) {
cin >> k; b.push_back(k);
}
sort(all(a));
sort(all(b));
if (a[n - 1] >= b[m - 1]) {
cout << "Alice" << endl;
}
else if (a[n - 1] <= b[m - 1]) {
cout << "Bob" << endl;
}
if (a[n - 1] <= b[m - 1]) {
cout << "Bob" << endl;
}
else if (a[n - 1] >= b[m - 1]) {
cout << "Alice" << endl;
}



}
}