Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- //задача 1
- int main()
- {
- int N, A, B, C;
- cin >> A >> B >> C;
- N = (C - A) / B;
- cout << N;
- }
- //задача 2
- int main()
- {
- int M,s3=0,s4=0;
- cin >> M;
- if (M == 0 || M == 1 || M == 2 || M == 5) {
- s3 = 0; s4 = 0;
- }
- else
- {
- while (M % 4 != 0) {
- s3++;
- M -= 3;
- }
- s4 = M / 4;
- }
- cout << s3 << endl << s4;
- }
- //задача 5
- int main()
- {
- int N,a,b,k;
- cin >> N>>k;
- a = N / pow(2, k);
- if (k%2!=0)
- b = N + 1 - a-pow(2,k);
- else
- b = N -2 - a - pow(2, k);
- if (a > b)
- cout << b << endl << a;
- else
- cout << a << endl << b;
- }
Add Comment
Please, Sign In to add comment