C++ dasturlash tilidagi yechimlar:
A. Soat
#include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
int hh = n / 3600;
n %= 3600;
int mm = n / 60;
n %= 60;
cout << hh/10 << hh%10 << " " << mm/10 << mm%10 << " " << n/10 << n % 10 << endl;
}
B. Hafta kuni
#include <iostream>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
cout << ((n + k - 1) % 7 + 6) % 7 + 1;
}
C. Modul
#include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
cout << (2 * n - 1) % 2 * n;
}
D. Min 2
#include <iostream>
using namespace std;
int main() {
long long a,b;
cin >> a >> b;
long long x = a + b;
long long y = a - b;
long long absy = (y * 2 + 1) % 2 * y;
cout << (x - absy) / 2;
return 0;
}
E. G'alati o'yin
#import <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int n1 = 0, n2 = 0, c1 = 0, c2 = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (x == n1) {
c1++;
} else if (x == n2) {
c2++;
} else if(c1 == 0) n1 = x, c1 = 1;
else if (c2 == 0) n2 = x, c2 = 1;
else {
c1--;
c2--;
}
}
c1 = c2 = 0;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
if (n1 == x) c1++;
else if (n2 == x) c2++;
}
if (c1 > n / 3) cout << n1 << " ";
if (c2 > n / 3) cout << n2 << " ";
if (c1 <= n / 3 && c2 <= n / 3) cout << "NO WINNER";
}