- UID
- 62930
注册时间2009-7-24
阅读权限20
最后登录1970-1-1
以武会友
TA的每日心情 | 开心 2024-12-6 17:12 |
---|
签到天数: 6 天 [LV.2]偶尔看看I
|
楼主 |
发表于 2009-8-28 21:55:03
|
显示全部楼层
- /******************************************************************************/
- /* Problem: a005 "Eva 的回家作業" from POJ */
- /* Language: C */
- /* Result: AC (10ms, 354KB) on ZeroJudge */
- /* Author: MicroQ at 2008-12-14 19:29:20 */
- /******************************************************************************/
- #include <stdio.h>
- #define MAX 4
- int main(int argc, char **argv)
- {
- int n,i;
- int a[MAX];
- scanf("%d", &n);
- while(n--)
- {
- for (i = 0; i < MAX; ++i)
- scanf("%d", &a[i]);
- for (i = 0; i < MAX; ++i)
- printf("%d ", a[i]);
- if (a[1] - a[0] == a[3] - a[2])
- printf("%d\n",a[3]*2 - a[2]);
- else
- printf("%d\n", a[3]*a[3]/a[2]);
- }
- return 0;
- }
复制代码
- /******************************************************************************/
- /* Problem: a010 "因數分解" */
- /* Language: C */
- /* Result: AC (28ms, 352KB) on ZeroJudge */
- /* Author: MicroQ at 2008-12-15 00:22:44 */
- /******************************************************************************/
- #include <stdio.h>
- #include <string.h>
- #define mod(x,y) (x)-(x)/(y)*(y)
- #define MAX 128
- int main(int argc, char **argv)
- {
- int i,j,n,t,s;
- while(scanf("%d", &n) > 0)
- {
- t = j = s = 0;
- while (n > 1)
- {
- for (i = 2; i <= n; ++i)
- {
- t = 0;
- j = 0;
- while (mod(n,i) == 0)
- {
- n /= i;
- ++t;
- j = 1;
- }
- if (j)
- {
- if (s != 0)
- printf(" * %d", i);
- else
- {
- printf("%d", i);
- s = 1;
- }
- if (t >= 2)
- printf("^%d", t);
- }
- }
- }
- printf("\n");
- }
-
- return 0;
- }
复制代码
[ 本帖最后由 evilknight 于 2009-8-28 22:57 编辑 ] |
|