Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int y1, y2, y3, y4, y5;
- int segfault(int x1, int x2, int x3) {
- int foo;
- if (x1 < 0 || x2 < 0 || x3 < 0) {
- return x1 + x2 + x3;
- }
- try {
- if ((x1 + x2 + x3) % 3 == 0) {
- y1++;
- foo = segfault(x1 - ((7*x1 + 3*x2 + 5*x3)%2) - 1, x2 + 2, x3);
- if ((9 * foo) % 5 >= 2) {
- throw Zob1(0);
- }
- }
- if ((x1 + x2 + x3) % 3 == 1) {
- y2++;
- foo = segfault(x1, x2 - ((7*x1 + 3*x2 + 5*x3)%2) - 1, x3 + 1);
- if ((5 * foo) % 7 >= 3) {
- throw Zob2(1);
- }
- }
- if ((x1 + x2 + x3) % 3 == 2) {
- y3++;
- foo = segfault(x1, x2, x3 - ((7*x1 + 3*x2 + 5*x3)%2) - 1);
- if ((4 * foo) % 3 == 2) {
- throw Zob3(2);
- }
- }
- }
- catch (Zob1 x) {
- if ((2*x1 + x2 + x3) % 3 == 0) {
- y4++;
- foo = segfault(x1 - 1, x2 + ((7*x1 + 3*x2 + 5*x3)%2) - 1, x3);
- if ((9 * foo) % 5 >= 2) {
- return ++y5;
- }
- else {
- return x1+x2;
- }
- }
- }
- catch (Zob2 x) {
- if ((2*x1 + x2 + x3) % 3 == 0) {
- y2++;
- foo = segfault(x1 - ((7*x1 + 3*x2 + 5*x3)%2) - 1, x2 + 2, x3 - 1);
- if ((13 * foo) % 7 >= 3) {
- return ++y4;
- }
- else {
- return 7*x1-x2+2*x3;
- }
- }
- }
- catch (Zob3 x) {
- if ((2*x1 + x2 + x3) % 3 == 0) {
- y2++;
- foo = segfault(x1 - 2, x2 + ((7*x1 + 3*x2 + 5*x3)%2) - 1, x3 - 1);
- if ((13 * foo) % 7 >= 3) {
- return ++y4;
- }
- else {
- return 7*x1-x2+2*x3;
- }
- }
- }
- return 3*x1 + 7*x2 + x3;
- }
- int main(int argc, char **argv) {
- int a,b,c;
- a = atoi(argv[1]);
- b = atoi(argv[2]);
- c = atoi(argv[3]);
- y1 = 0;
- y2 = 0;
- y3 = 0;
- y4 = 0;
- y5 = 0;
- try {
- segfault(a,b,c);
- }
- catch (Zob1 x) {}
- catch (Zob2 x) {}
- catch (Zob3 x) {}
- finally {
- printf("y1 : %d\ny2 : %d\ny3 : %d\ny4 : %d\ny5 : %d\n", y1, y2, y3, y4, y5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement