- UID
- 62930
注册时间2009-7-24
阅读权限20
最后登录1970-1-1
以武会友
TA的每日心情 | 开心 2024-12-6 17:12 |
---|
签到天数: 6 天 [LV.2]偶尔看看I
|
楼主 |
发表于 2009-8-30 22:07:13
|
显示全部楼层
- /**********************************************************************************/
- /* Problem: a024 "最大公因數(**)" */
- /* Language: C */
- /* Result: AC (10ms, 360KB) on ZeroJudge */
- /* Author: MicroQ */
- /**********************************************************************************/
- #include <stdio.h>
- long long int f(long long int a, long long int b)
- {
- long long int t;
- while (a%b)
- {
- t = b;;
- b = a%b;
- a = t;
- }
- return b;
- }
- int main(void)
- {
- long long int a,b;
- while ( scanf("%lld%lld",&a, &b) > 0)
- printf("%lld\n", f(a,b));
- return 0;
- }
复制代码
- #include <stdio.h>
- int main(void)
- {
- long long int sum;
- int n, i;
- while (scanf("%d", &n) > 0)
- {
- sum = 1;
- for (i = 2; i <= n; ++i)
- sum *= i;
- printf("%lld\n", sum);
- }
- return 0;
- }
复制代码 |
|