[2006-06-09]NOC2005我作对的题目
ABC
* CAB
-------------
AXCAXC
就是这样一个乘法题目,算来不难,因此得到3等奖
/* * NOC2005* Program: David Zhang (2006-Jun-9)* E_mail: crispgm@gmail.com*/#include <stdio.h>#include <stdlib.h>#include <string.h>void main(){ long int a,b,c,x,y,z; long int t,p,q,total; char s[20]; for(a=1;a<=9;a++){ for(b=1;b<=9;b++){ for(c=0;c<=9;c++){ if(a!=b && b!=c){ p=a*100+b*10+c; q=b*100+a*10+c; total=p*q; if(total>=100000 && total<=999999){ t=p*c; ltoa(t,s,10); if(strlen(s)==4){ t=p*a; ltoa(t,s,10); x=t%100; y=x%10; if(y==a && strlen(s)==3){ t=p*b; ltoa(t,s,10); x=t%1000; y=x%100; z=y%10; if(z==b && strlen(s)==4) printf(" %d\n* %d\n------\n%d\n",p,q,total); } } } } } }}