HDU 1405 坑爹的The Last Practice
来源:互联网 发布:詹姆斯五项数据第一 编辑:程序博客网 时间:2024/05/16 12:17
链接地址:http://acm.hdu.edu.cn/showproblem.php?pid=1405
此题真坑!!!
题意很容易就能看懂,坑爹的地方就在“每个数字后都有一个空格,包括最后一个数字”。
以下是我AC的代码:
此题真坑!!!
题意很容易就能看懂,坑爹的地方就在“每个数字后都有一个空格,包括最后一个数字”。
以下是我AC的代码:
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, num, p, ca = 1;
while (scanf("%d", &n) && n > 0)
{
if (ca - 1) printf("\n");
printf("Case %d.\n", ca++);
num = p = 0;
if (n % 2 == 0)
{
p = 1;
printf("2 ");
}
while (n % 2 == 0)
{
num++;
n /= 2;
}
if (num) printf("%d", num);
for (int i = 3; i <= n; i += 2)
{
num = 0;
if (n % i == 0)
{
if (p) printf(" ");
p = 1;
printf("%d ", i);
}
while (n % i == 0)
{
num++;
n /= i;
}
if (num) printf("%d", num);
}
printf(" \n");
}
return 0;
}
0 0
- HDU 1405 坑爹的The Last Practice
- hdu 1405 The Last Practice
- The Last Practice hdu 1405
- HDU 1405 The Last Practice
- HDU 1405The Last Practice
- HDU 1405 The Last Practice
- HDU 1405 The Last Practice
- HDU The Last Practice
- HDU 1405 The Last Practice(数学题,变态的格式)
- hdu 1405 The Last Practice (数学)
- hdu-oj 1405 The Last Practice
- HDU 1405 The Last Practice(暴力枚举)
- HDU 1405 The Last Practice
- hdu 1405 The Last Practice 数论水题
- HDU 1405 The Last Practice 数学水题
- HDU 1405 The Last Practice【注意输出格式】
- 杭电 HDU ACM 1405 The Last Practice
- HDU——1405The Last Practice(试手map)
- UVA 10557 XYZZY
- ACM之纠结篇:Ordering Tasks
- N 封信 with N 信封
- HDU 1202 The calculation of GPA
- HDU 1266 Reverse Number
- HDU 1405 坑爹的The Last Practice
- NOJ [1201] Chihuo II - Eating in China
- NOJ [1271] Nth Day is Which Day
- NOJ [1274] The battle of Red Cliff
- NOJ [1267] Flying Chess
- NOJ [1273] So Long the String
- NOJ [1275] Play or Not Play
- NOJ [1288] Eating Sweets
- NOJ [1285] The TT Candy