Code Refactoring

Time Limit: 3000ms
Memory Limit: 131072KB
 
This problem will be judged on UVA. Original ID: 10879
64-bit integer IO format: %lld      Java class name: Main
 
 
Problem B
Code Refactoring
Time Limit: 2 seconds

"Harry, my dream is a code waiting to be
broken. Break the code, solve the crime."


Agent Cooper

Several algorithms in modern cryptography are based on the fact that factoring large numbers is difficult. Alicia and Bobby know this, so they have decided to design their own encryption scheme based on factoring. Their algorithm depends on a secret code, K, that Alicia sends to Bobby before sending him an encrypted message. After listening carefully to Alicia's description, Yvette says, "But if I can intercept K and factor it into two positive integers, A and B, I would break your encryption scheme! And theK values you use are at most 10,000,000. Hey, this is so easy; I can even factor it twice, into two different pairs of integers!"

Input
The first line of input gives the number of cases, N (at most 25000). N test cases follow. Each one contains the code, K, on a line by itself.

Output
For each test case, output one line containing "Case #xK = A * B = C * D", where ABC and D are different positive integers larger than 1. A solution will always exist.

Sample Input Sample Output
3
120
210
10000000
Case #1: 120 = 12 * 10 = 6 * 20
Case #2: 210 = 7 * 30 = 70 * 3
Case #3: 10000000 = 10 * 1000000 = 100 * 100000
 #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#define LL long long
using namespace std;
int main(){
int kase,x,i,j,k = ;
int a[],b[];
scanf("%d",&kase);
while(kase--){
scanf("%d",&x);
for(j = ,i = ; i < x && j < ; i++){
if(x%i == ){
a[j] = i;
b[j++] = x/i;
}
}
printf("Case #%d: %d = %d * %d = %d * %d\n",k++,x,a[],b[],a[],b[]);
}
return ;
}

BNUOJ 19297 Code Refactoring的更多相关文章

  1. 探究重构代码(Code refactoring)

    Code refactoring 是什么 在不改变软件的外部行为的条件下,通过修改代码改变软件内部结构,将效率低下和过于复杂的代码转换为更高效.更简单和更简单的代码. 怎样执行Code refacto ...

  2. taiyi_interview(Introduction To Database Refactoring)

    Introduction To Database Refactoring 原文链接:by Scott W. Ambler:http://www.tdan.com/view-articles/5010/ ...

  3. Code Complete阅读笔记(二)

    2015-03-06   328   Unusual Data Types    ——You can carry this technique to extremes,putting all the ...

  4. 探究代码审查(Code review)

    Code review 是什么 对软件源代码的系统性检查,查找软件源代码质量,结构,漏洞等问题. PS:Code review  ≍ Code inspections ≥ Code walkthrou ...

  5. jQuery WipeTouch

    有时,当你只想为触屏划动添加事件时,很多人可能会想到,Jquery mobile,但就这么个功能就把人家这么高大上的东西引用进来就有点大才小用了,WipeTouch是国外某程序员写的针对触屏划动的jq ...

  6. UVA题目分类

    题目 Volume 0. Getting Started 开始10055 - Hashmat the Brave Warrior 10071 - Back to High School Physics ...

  7. Domain Driven Design and Development In Practice--转载

    原文地址:http://www.infoq.com/articles/ddd-in-practice Background Domain Driven Design (DDD) is about ma ...

  8. 【转】Git代码提交最佳实践

      GIT Commit Good Practice The following document is based on experience doing code development, bug ...

  9. Recommended add-ons/plugins for Microsoft Visual Studio [closed]

    SmartPaster - (FREE) Copy/Paste code generator for strings AnkhSvn - (FREE) SVN Source Control Integ ...

随机推荐

  1. JavaScript 获取浏览器版本

    //获取IE版本function GetIEVersions(){ var iejson={ isIE:false,safariVersion:0 }; var ua = navigator.user ...

  2. lnmp.org + phpstorm + xdebug

    lnmp.org下载安装包安装之: lnmp是个集成安装包,就不用自己在配置lnmp环境 安装phpstorm,破解方法:注册服务器为http://idea.lanyus.com 就可以了 xdebu ...

  3. Todolist总结

    一.组件类里面的函数尽可能写成箭头函数的形式,方便绑定this 上面的箭头函数是好的,写面的不好,他需要在用的时候绑定this,或者在constructor绑定,如下: 如上用的时候绑定this是不好 ...

  4. 最详细的github快速入门教程

    一:下载github 二:安装GitHub 下载之后点击 进行安装过程,安装之后桌面上会有两个图标,如下图 三:新建项目 GitHub是图形界面模式,Git Shell是命令行模式,在Windows系 ...

  5. MySQL存储过程(更新指定字段的数据)

    mysql存储过程示例: USE 数据库名称;DROP PROCEDURE IF EXISTS 数据库名称.存储过程名称;delimiter $$CREATE PROCEDURE 数据库名称.存储过程 ...

  6. 查询sqlserver数据库,表占用数据大小

     if exists(select 1 from tempdb..sysobjects where id=object_id('tempdb..#tabName') and xtype='u')dro ...

  7. 解决Starting to watch source with Jekyll and Compass. Starting Rack on port 4000

    问题 Starting to watch source with Jekyll and Compass. Starting Rack on port 4000 rake aborted! Errno: ...

  8. 8 Java 归并排序(MergerSort)

    图片素材与文字描述来自:尚硅谷-韩顺平数据结构与算法. 1.基本思想 归并排序是利用归并的思想实现的排序方法,该算法采用经典的分治(divide-and-conquer)策略(分治法将问题分(divi ...

  9. 几句话总结一个算法之RNN、LSTM和GRU

    RNN 一般神经网络隐层的计算是h=g(w * x),其中g是激活函数,相比于一般神经网络,RNN需要考虑之前序列的信息,因此它的隐藏h的计算除了当前输入还要考虑上一个状态的隐藏,h=g(w*x+w' ...

  10. kafka启动报错&问题解决

    kafka启动报错&问题解决 一早上班,就收到运维同事通知说有一台物理机宕机,导致虚拟机挂了.只得重启kafka服务器. 1.启动 启动zookeeper bin/zkServer.sh st ...