就是暴力嘛。。。很水的一个题。。。

不好意思交都。。。

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cstring>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#define MOD 2018
#define LL long long
#define ULL unsigned long long
#define Pair pair<int, int>
#define mem(a, b) memset(a, b, sizeof(a))
#define _ ios_base::sync_with_stdio(0),cin.tie(0)
//freopen("1.txt", "r", stdin);
using namespace std;
const int maxn = , INF = 0x7fffffff;
int primes[maxn], base[maxn], mi[maxn];
int vis[maxn];
int ans = ;
set<int> s;
void init()
{
mem(vis, );
for(int i=; i<maxn; i++)
{
if(vis[i]) continue;
primes[ans++] = i;
for(LL j=(LL)i*i; j<maxn; j+=i)
vis[j] = ;
}
} int main()
{
init();
int T, kase = ;
scanf("%d",&T);
while(T--)
{
s.clear();
mem(base, ); int n;
scanf("%d",&n);
for(int i=; i<=n; i++)
{
int temp = i;
for(int j=; j<ans && primes[j] * primes[j] <= temp; j++)
{
while(temp % primes[j] == )
{
temp /= primes[j];
base[primes[j]]++;
}
if(base[primes[j]] > )
{
s.insert(primes[j]);
}
}
if(temp > )
{
base[temp]++;
s.insert(temp);
}
}
printf("Case %d: %d = ",++kase, n);
int cnt = ;
for(set<int>::iterator it=s.begin(); it!=s.end(); it++)
{
if(cnt == )
printf("%d (%d)",*it, base[*it]);
else
printf(" * %d (%d)",*it, base[*it]);
cnt++;
}
printf("\n"); } return ;
}

Intelligent Factorial Factorization LightOJ - 1035(水题)的更多相关文章

  1. light oj 1035 - Intelligent Factorial Factorization 素因子分解

    1035 - Intelligent Factorial Factorization Given an integer N, you have to prime factorize N! (facto ...

  2. lightoj 1010 (水题,找规律)

    lightoj 1010 Knights in Chessboard 链接:http://lightoj.com/volume_showproblem.php?problem=1010 题意:国际象棋 ...

  3. LightOJ 1166 Old Sorting 置换群 或 贪心 水题

    LINK 题意:给出1~n数字的排列,求变为递增有序的最小交换次数 思路:水题.数据给的很小怎么搞都可以.由于坐标和数字都是1~n,所以我使用置换群求循环节个数和长度的方法. /** @Date : ...

  4. LightOJ 1065 - Number Sequence 矩阵快速幂水题

    http://www.lightoj.com/volume_showproblem.php?problem=1065 题意:给出递推式f(0) = a, f(1) = b, f(n) = f(n - ...

  5. Lightoj 1112 - Curious Robin Hood 【单点改动 + 单点、 区间查询】【树状数组 水题】

    1112 - Curious Robin Hood PDF (English) Statistics Forum Time Limit: 1 second(s) Memory Limit: 64 MB ...

  6. sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理)

    n a^o7 ! Time Limit: 1000MS Memory limit: 65536K 题目描述 All brave and intelligent fighters, next you w ...

  7. hdu 1018:Big Number(水题)

    Big Number Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  8. HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)

    Problem Description You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or ...

  9. D - 楼下水题(kmp+Manacher)

    D - 楼下水题 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Statu ...

随机推荐

  1. 配置centos7来支持xshell远程访问和xftp传输文件

    前提: 首先需要一台已装有centos7的电脑(虚拟机的配置这里不说明,这里用的是物理机) 背景: 在工作中访问linux的环境通常需要Xshell等终端软件,通过配置静态IP远程服务器进行管理开发. ...

  2. python时间模块详解(time模块)

    time 模块 -- 时间获取和转换 time 模块提供各种时间相关的功能 在 Python 中,与时间处理有关的模块包括:time,datetime 以及 calendar 必要说明: 虽然这个模块 ...

  3. Kickstart Round G 2018

    第一次打codejam....惨的一比,才A1.5题,感觉自己最近状态渣到姥姥家了,赶紧练练 A 模拟,注意0的问题 #include <iostream> #include <cs ...

  4. 管理项目中的贴图-Texture overview插件

    Texture overview插件管理项目中的贴图 1. Assetstore地址 2. 总览项目中所有贴图 3. 针对不同平台的贴图压缩设置 在插件的右上角 4. 支持多选批量修改 5. 点击表头 ...

  5. SICP读书笔记 2.1

    SICP CONCLUSION 让我们举起杯,祝福那些将他们的思想镶嵌在重重括号之间的Lisp程序员 ! 祝我能够突破层层代码,找到住在里计算机的神灵! 目录 1. 构造过程抽象 2. 构造数据抽象 ...

  6. DWR、Comet4j在Nginx+Tomcat组合下的优化

    DWR.Comet4j这类推送框架在Tomcat下运行正常,但在nginx+tomcat组合下,可能会出现断连.延迟等各种问题. 如出现此类问题,可尝试以下优化方式: 1.Nginx-----ngin ...

  7. MathExam第二次作业

    第二次作业:MathExam 一.预估与实际 PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟) Planning 计划 20 30 • ...

  8. Sprint7

    进展:根据昨天查到的资料,今天开始编写闹钟部分的代码,主要实现了闹钟添加事件显示时间主界面.

  9. Leetcode题库——23.合并k个排序链表

    @author: ZZQ @software: PyCharm @file: mergeKLists.py @time: 2018/10/12 19:55 说明:合并 k 个排序链表,返回合并后的排序 ...

  10. Good Time 冲刺 六

    一.今日完成任务情况 第六天 日期:2018.6.19 王怡镔:今天完善了页面,对部分不足进行改进. 于鑫宇:对界面进行完善. 胡雅馨:今天完成前端页面,并改善后端,完善项目. 黄 鹤:做完最后的打卡 ...