/* * @(#) msu97_b.c - Problem 'B' ("The cubical magic") solution * of the ACM Programming Contest at the MSU in 1997. * (c) 1998 Ivan Maidanski http://ivmai.chat.ru * Freeware program source. All rights reserved. ** * Language: ANSI C * Tested with: Borland C++ v3.1 * Last modified: 1998-10-07 23:10:00 GMT+04:00 */ /* Input data file: b.dat */ #include /* FILE, fopen(), fscanf(), printf() */ void adjcoord(long *pa, long *pb) { long t; if (*pa>*pb) { t=*pa; *pa=*pb; *pb=t; } } int main() { FILE *f=fopen("b.dat","rt"); int n,k,t; long x1,y1,z1,x2,y2,z2; long xu1,yu1,zu1,xu2,yu2,zu2; fscanf(f,"%*[^-0-9]%d",&n); while (0x2 || yu1>y2 || zu1>z2 || xu2x2) xu2=x2; if (yu2>y2) yu2=y2; if (zu2>z2) zu2=z2; } if (t) if ((xu2-xu1)*(yu2-yu1)*(zu2-zu1)!=666) printf("The intersection volume is %ld cubical light years.\n", (xu2-xu1)*(yu2-yu1)*(zu2-zu1)); else printf("This universe is perfect.\n"); else printf("This universe is not complete.\n"); } else printf("The intersection volume is 0 cubical light years.\n"); } return 0; }