C. Petya and Inequiations
C. Petya and Inequiations
题意:
给你一个数字 n,x,y
求使得
满足这个条件的 数组 a
问题分析:
尽量保证其中一个 平方数最大就行
因为一个数 分解成 几个数 取平方后的 和
的最大值一定是 除了其中一个数以外其他都是1
为啥?、、、、、
我也有点懵,,,我感觉应该可以靠 y=x^2 的图来解释
。。。。。
具体看代码
AC代码:
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<vector>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<sstream>
#include<algorithm>
using namespace std;
#define ll long long
#define mem(a,b) memset((a),(b),sizeof(a));
#define lowbit(a) ((a)&-(a))
const ll inf=0x3f3f3f3f;//1061109567,2*未超int,allinf=mem(a,0x3f,sizeof(a));
const int N=1e3+10;
int main(){//#define io
#ifdef iofreopen("in.txt","r",stdin);
#endifcin.tie(0);ll n,x,y,sum;sum=0;cin>>n>>x>>y;ll ma=y-n+1;sum=pow(ma,2)+n-1;if(sum>=x&&ma>0){cout<<ma<<endl;;for(int i=0;i<n-1;i++){cout<<1<<endl;}}else{cout<<-1;}return 0;
}
C. Petya and Inequiations相关推荐
- codeforces 111A/112C Petya and Inequiations
题目:Petya and Inequiations 传送门: http://codeforces.com/problemset/problem/111/A http://codeforces.com/ ...
- Petya and Inequiations 题解
Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the fol ...
- 【翻译】旧技术成就新勒索软件,Petya添加蠕虫特性
原文链接:https://blogs.technet.microsoft.com/mmpc/2017/06/27/new-ransomware-old-techniques-petya-adds-wo ...
- Petya and Exam
Description It's hard times now. Today Petya needs to score 100 points on Informatics exam. The task ...
- Petya and Exam 模拟
It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy ...
- Petya勒索病毒(2016.4月样本)分析笔记
前言 之所以不叫分析报告,是因为接下来要看到的分析,可能包含了不正确的,或者有疑点,和未完全分析的,里面有我个人的主观臆断,或者一些我目前未察觉的错误,还有一些非常基础,非常啰嗦的内容,这都是为了复习 ...
- Petya and Strings
文章目录 一.Petya and Strings 总结 一.Petya and Strings 本题链接: 题目: A. Petya and Strings time limit per test2 ...
- 112A.Petya and Strings
112A.Petya and Strings 题目 翻译 题目 输入 输出 分析 代码 题目 翻译 题目 小Petya喜欢礼物.他妈妈为了他的生日买来了2个相同长度的字符串.字符串由大小写拉丁字母组成 ...
- Petya and Countryside
Description Little Petya often travels to his grandmother in the countryside. The grandmother has a ...
最新文章
- 不懂装饰器,就不是真正会 Python
- ANTLR入门:构建一种简单的表达语言
- 消息队列NetMQ 原理分析2-IO线程和完成端口
- ASP.NET2.0中Calendar的使用(添加自己的日期备注)
- 性能服务器如何放进ppt,Linux服务器性能评估与优化.ppt
- 动软代码生成器 模板
- python 区块链_python与区块链
- linux安装yarn
- nmds与mds的区别_NMDS非度量多维尺度分析—基于微生物群落
- 1×pbs缓冲液配方_pbs配方_1xpbs配方_pbs缓冲液配制
- 目标检测—DiffusionDet:用于检测的概率扩散模型笔记—DDPM
- 这篇文章来告诉你几个实用的视频转文字的方法
- C语言PAT刷题 - 1020 月饼
- 传记-《硅谷钢铁侠》书中的精髓:从埃隆·马斯克的精神世界和人格特质里,找寻成功的秘密。
- 史上最全的定位攻略,您应该知道的定位方法。
- SS524V100 SDK安装编译osdrv问题汇总
- 安装manjaro-i3 conky 乱码问题
- 小米手机开发版、稳定版刷机和root等操作
- php如何连接access,php如何连接access数据库代码
- ODM文件搜索下载器
热门文章
- 解决import lief运行报错问题
- 校园助手APP--简介及框架
- [USACO13FEB]拖拉机Tractor
- 一维数组(简单摇骰子小游戏)
- 「WinddowInsets(二)」我们能用WindowInsets做什么?
- Data Structures and Algorithms (English) - 6-8 Percolate Up and Down(20 分)
- 循环控制语句--for循环
- Vue 祖孙方法调用 祖父级方法在孙级调用 祖孙传参
- HTML5 实现小车动画效果(Canvas/CSS3/JQuery)
- 没有打不了的补丁切不了的面