codeforce A. Design Tutorial: Learn from Math
题意:将一个数拆成两个合数的和, 输出这两个数!(这道题做的真是TMD水啊)开始的时候不知道composite numbers是啥意思,看了3遍才看懂....
看懂之后又想用素数筛选法来做,后来决定单个判断一个数是否为素数的方法来写,结果写错了两次,快疯掉了简直....
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define N 1000005
using namespace std; bool prime(int x){
int n = (int)sqrt(x*1.0);
int i;
for(i=; i<=n; ++i)
if( x % i == )
break;
if(i>n) return true;
return false;
} int main(){ int n;
cin>>n;
for(int i=; i<=n/; ++i){
if( !prime(i) && !prime(n-i)){
cout<<i<<" "<<n-i<<endl;
break;
}
}
return ;
}
codeforce A. Design Tutorial: Learn from Math的更多相关文章
- cf472A Design Tutorial: Learn from Math
A. Design Tutorial: Learn from Math time limit per test 1 second memory limit per test 256 megabytes ...
- Codeforces Round #270 A. Design Tutorial: Learn from Math【数论/埃氏筛法】
time limit per test 1 second memory limit per test 256 megabytes input standard input output standar ...
- A - Design Tutorial: Learn from Math(哥德巴赫猜想)
Problem description One way to create a task is to learn from math. You can generate some random mat ...
- 【CodeForces 472A】Design Tutorial: Learn from Math
题 题意:给你一个大于等于12的数,要你用两个合数表示出来.//合数指自然数中除了能被1和本身整除外,还能被其他的数整除(不包括0)的数. 分析:我们知道偶数除了2都是合数,给你一个偶数,你减去一个偶 ...
- codeforces水题100道 第七题 Codeforces Round #270 A. Design Tutorial: Learn from Math (math)
题目链接:http://www.codeforces.com/problemset/problem/472/A题意:给你一个数n,将n表示为两个合数(即非素数)的和.C++代码: #include & ...
- cf472B Design Tutorial: Learn from Life
B. Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes ...
- Codeforces Round #270--B. Design Tutorial: Learn from Life
Design Tutorial: Learn from Life time limit per test 1 second memory limit per test 256 megabytes in ...
- codeforces B. Design Tutorial: Learn from Life
题意:有一个电梯,每一个人都想乘电梯到达自己想要到达的楼层!从a层到b层的时间是|a-b|, 乘客上下电梯的时间忽略不计!问最少需要多少的时间.... 这是一道神题啊,自己的思路不知不觉的就按 ...
- Design Tutorial: Learn from Life
Codeforces Round #270 B:http://codeforces.com/contest/472/problem/B 题意:n个人在1楼,想要做电梯上楼,只有1个电梯,每次只能运k个 ...
随机推荐
- ftp如何预览图片 解决方案
下载使用 server-U ,开启 HTTP 服务,输入 http://ip:端口 后,登录ftp账号密码,可选使用 基于java的应用 web client 或 FTP Voyager JV,来预览 ...
- 从一个例子中体会React的基本面
[起初的准备工作] npm init npm install --save react react-dom npm install --save-dev html-webpack-plugin web ...
- 线程同步中使用信号量AutoResetEvent
using System; using System.Threading; namespace ConsoleApplication1 { class Program { static void Ma ...
- Java 周历日历
WeekCalendarUtils工具类代码,传入起始日期即可返回对应日期的周历日历,年月部分添加周数统计 import java.util.Calendar; import java.util.Da ...
- html5media.js 让浏览器兼容<Video><Audio> 标签
介绍:https://html5media.info/ 项目:https://github.com/etianen/html5media Wiki:https://github.com/etianen ...
- ecshop利用.htaccess实现301重定向的方法
实现方法如下(空间必须支持对目录中的.htaccess文件解析) 打开 .htaccess 找到 RewriteEngine on 它的下方添加 RewriteCond %{HTTP_HOST} ^需 ...
- 【终极解决方案】为应用程序池“XXX”提供服务的进程在与 Windows Process Activation Service 通信时出现严重错误。该进程 ID 为“XXXX”。数据字段包含错误号。
困扰我大半年的错误,今天偶然间被解决了,特此分享给被同样问题纠结的朋友们! 之前的求助帖,无人应答: http://www.cnblogs.com/freeton/archive/2012/08/28 ...
- 高吞吐量的分布式发布订阅消息系统Kafka-- 管理工具 Kafka Manager
一.概述 Kafka在雅虎内部被很多团队使用,媒体团队用它做实时分析流水线,可以处理高达20Gbps(压缩数据)的峰值带宽. 为了简化开发者和服务工程师维护Kafka集群的工作,构建了一个叫做Kafk ...
- 使用PuTTY时的文件上传下载方法
如果你是个PuTTY重度用户,在使用ssh连上一个远端机器工作了好一阵子后,发现自己需要对 当前会话 上传/下载文件,要怎样才能简单快捷呢? 最简单的方式 最简单的方法: 安装WinSCP或者File ...
- java.util.Properties类
http://trans.blog.51cto.com/503170/110227/ http://soft.chinabyte.com/database/395/12625895.shtml