Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int h(int x);
- int f(int x){
- if(x == 4) return 1;
- return 3*f(((2*x+2)%11)-1);
- }
- int q(int x){
- if(x == 7) return 1;
- return f(x) + q((3*x)%10);
- }
- int g(int x){
- if(x == 0) return 1;
- return (g(x-1)+f(g(x-1)) + f(x-1) + h(x-1))%10;
- }
- int h(int x){
- if(x == 0) return 1;
- return (2*h(x-1) + g(x-1) + q(f(x-1)%10))%10;
- }
- int main() {
- // SUBTASK A :
- cout << g(4);
- // SUBTASK B :
- cout << g(7);
- // SUBTASK C :
- cout << h(6);
- return 0;
- }
Add Comment
Please, Sign In to add comment