NOIP 普及组 2014 比例简化
https://www.cnblogs.com/violet-acmer/p/9898636.html
题解:
一开始想多了,以为得保证两者之间的相对比率,至少不能改变的太离谱啊。
but,直接暴力就过了。。。。。。。
AC代码:
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define eps 1e-8
#define P pair<int ,int >
const int maxn=+;
int A,B,L;
int prime[maxn][maxn];
int tot[maxn];
bool isPrime(int x,int y)//判断 x 与 y 是否互质
{
if(x < y)
swap(x,y);
for(int i=;i <= y;++i)
if(x%i == && y%i == )
return false;
return true;
}
void Solve()
{
P res;
res=P(,);
for(int i=;i <= L;++i)
for(int j=;j <= L;++j)
if(isPrime(i,j) && i*B >= j*A)
{
if(res.first == || i*res.second < j*res.first)
res.first=i,res.second=j;
}
printf("%d %d\n",res.first,res.second);
}
int main()
{
scanf("%d%d%d",&A,&B,&L);
Solve();
}
NOIP 普及组 2014 比例简化的更多相关文章
- NOIP 普及组 2014 螺旋矩阵
传送门 https://www.cnblogs.com/violet-acmer/p/9898636.html 题解: 这道题挺有意思的,有点考思维吧. 大体思路是用四个pair<int ,in ...
- NOIP 普及组 2014 珠心算测验
传送门 https://www.cnblogs.com/violet-acmer/p/9898636.html 题解: 枚举两两间出所有的可能加和,然后遍历一遍这 n 个数,找出满足条件的总个数. 这 ...
- 2016.8.15上午纪中初中部NOIP普及组比赛
2016.8.15上午纪中初中部NOIP普及组比赛 链接:https://jzoj.net/junior/#contest/home/1333 这次比赛不怎么好,因为这套题目我并不是很擅长. 可同学们 ...
- 2016.9.15初中部上午NOIP普及组比赛总结
2016.9.15初中部上午NOIP普及组比赛总结 2016.09.15[初中部 NOIP普及组 ]模拟赛 又翻车了!表示时超和空超很可恨! 进度 比赛:AC+0+0+20=120 改题:AC+80+ ...
- 2016.9.10初中部上午NOIP普及组比赛总结
2016.9.10初中部上午NOIP普及组比赛总结 链接:https://jzoj.net/junior/#contest/home/1340 好不爽!翻车了!不过排名差不多在中间偏上一点, 还好不是 ...
- 2016.9.3初中部上午NOIP普及组比赛总结
2016.9.3初中部上午NOIP普及组比赛总结 链接:https://jzoj.net/junior/#contest/home/1339 这次真爽,拿了个第四!(我还被班主任叫过去1小时呢!) 进 ...
- 2016.8.19上午初中部NOIP普及组比赛总结
2016.8.19上午初中部NOIP普及组比赛总结 链接:https://jzoj.net/junior/#contest/home/1338 这次总结发得有点晚啊!我在这里解释一下, 因为浏览器的问 ...
- 2016.8.18上午纪中初中部NOIP普及组比赛
2016.8.18上午纪中初中部NOIP普及组比赛 链接:https://jzoj.net/junior/#contest/home/1336 翻!车!啦!好吧,那是因为大神归来. 进度: 比赛:AC ...
- 2016.8.17上午纪中初中部NOIP普及组比赛
2016.8.17上午纪中初中部NOIP普及组比赛 链接:https://jzoj.net/junior/#contest/home/1335 本来觉得自己能考高分,但只得160分,并列第九.至少又挤 ...
随机推荐
- Linux内核分析作业第八周
进程的切换和系统的一般执行过程 一.进程调度的时机 中断处理过程(包括时钟中断.I/O中断.系统调用和异常)中,直接调用schedule(),或者返回用户态时根据need_resched标记调用sch ...
- 什么是Consul
什么是Consul Consul文档简要整理 什么是Consul? Consul是一个用来实现分布式系统的服务发现与配置的开源工具.他主要由多个组成部分: 服务发现:客户端通过Consul提供服务,类 ...
- 配置wbepack
proxyTable:{ //反向代理 先建立连接 '/sexLady':{ target:url//请求地址 暗号:'/sexLady ' changeOrigin:true ,//类似baseUr ...
- node之jade和ejs的使用方法 jade篇
let express = require('express'); let consolidate = require('consolidate'); let app = express(); // ...
- VMMAP的简单使用
1. dotnet.exe 进程占用内存非常疯狂.. 开发同事 提供了一个工具进行简单分析 vmmap.exe 执行了 Ctrl+E 之后 发现将 heap 和managed heap 的内容放到了p ...
- [cnblog新闻]阿里的营业利润3倍于亚马逊,但为何市值只是亚马逊的一半?
阿里的营业利润3倍于亚马逊,但为何市值只是亚马逊的一半? 投递人 itwriter 发布于 2019-01-26 16:52 评论(0) 有688人阅读 原文链接 [收藏] « » http://ww ...
- Kali2.0的简单使用--开启root用户登录
1. 安装完kali之后 2. 修改/etc/ssh/sshd_conf的文件 将: #PasswordAuthentication no 修改为: PasswordAuthentication ye ...
- codeforces548B
Mike and Fun CodeForces - 548B Mike and some bears are playing a game just for fun. Mike is the judg ...
- poj2586 【贪心】
Accounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for ...
- hdu 1025
Problem Description JGShining's kingdom consists of 2n(n is no more than 500,000) small cities which ...