2009-01-15 16:44:32來源不明
2008 NPSC D. 沙之國
/*********************************************************/
- #include<stdio.h>
- #include<stdlib.h>
- #include<string.h>
- main()
- {
- int a,b,c,p,temp=0;
- while(scanf("%d",&a)==1)
- {
- for(b=0;b<a;b++)
- {
- temp=0;
- scanf("%d",&p);
- while(p>0)
- {
- while(p>=27)
- {
- p=p-27;
- temp++;
- }
- while(p>=9)
- {
- p=p-9;
- temp++;
- }
- while(p>=3)
- {
- p=p-3;
- temp++;
- }
- while(p>=1)
- {
- p--;
- temp++;
- }
- }
- printf("%d\n",temp);
- }
- }
- return 0;
- }