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相关推荐

  1. codeforces 111A/112C Petya and Inequiations

    题目:Petya and Inequiations 传送门: http://codeforces.com/problemset/problem/111/A http://codeforces.com/ ...

  2. Petya and Inequiations 题解

    Little Petya loves inequations. Help him find n positive integers a1, a2, ..., an, such that the fol ...

  3. 【翻译】旧技术成就新勒索软件,Petya添加蠕虫特性

    原文链接:https://blogs.technet.microsoft.com/mmpc/2017/06/27/new-ransomware-old-techniques-petya-adds-wo ...

  4. Petya and Exam

    Description It's hard times now. Today Petya needs to score 100 points on Informatics exam. The task ...

  5. Petya and Exam 模拟

    It's hard times now. Today Petya needs to score 100 points on Informatics exam. The tasks seem easy ...

  6. Petya勒索病毒(2016.4月样本)分析笔记

    前言 之所以不叫分析报告,是因为接下来要看到的分析,可能包含了不正确的,或者有疑点,和未完全分析的,里面有我个人的主观臆断,或者一些我目前未察觉的错误,还有一些非常基础,非常啰嗦的内容,这都是为了复习 ...

  7. Petya and Strings

    文章目录 一.Petya and Strings 总结 一.Petya and Strings 本题链接: 题目: A. Petya and Strings time limit per test2 ...

  8. 112A.Petya and Strings

    112A.Petya and Strings 题目 翻译 题目 输入 输出 分析 代码 题目 翻译 题目 小Petya喜欢礼物.他妈妈为了他的生日买来了2个相同长度的字符串.字符串由大小写拉丁字母组成 ...

  9. Petya and Countryside

    Description Little Petya often travels to his grandmother in the countryside. The grandmother has a ...

最新文章

  1. 不懂装饰器,就不是真正会 Python
  2. ANTLR入门:构建一种简单的表达语言
  3. 消息队列NetMQ 原理分析2-IO线程和完成端口
  4. ASP.NET2.0中Calendar的使用(添加自己的日期备注)
  5. 性能服务器如何放进ppt,Linux服务器性能评估与优化.ppt
  6. 动软代码生成器 模板
  7. python 区块链_python与区块链
  8. linux安装yarn
  9. nmds与mds的区别_NMDS非度量多维尺度分析—基于微生物群落
  10. 1×pbs缓冲液配方_pbs配方_1xpbs配方_pbs缓冲液配制
  11. 目标检测—DiffusionDet:用于检测的概率扩散模型笔记—DDPM
  12. 这篇文章来告诉你几个实用的视频转文字的方法
  13. C语言PAT刷题 - 1020 月饼
  14. 传记-《硅谷钢铁侠》书中的精髓:从埃隆·马斯克的精神世界和人格特质里,找寻成功的秘密。
  15. 史上最全的定位攻略,您应该知道的定位方法。
  16. SS524V100 SDK安装编译osdrv问题汇总
  17. 安装manjaro-i3 conky 乱码问题
  18. 小米手机开发版、稳定版刷机和root等操作
  19. php如何连接access,php如何连接access数据库代码
  20. ODM文件搜索下载器

热门文章

  1. 解决import lief运行报错问题
  2. 校园助手APP--简介及框架
  3. [USACO13FEB]拖拉机Tractor
  4. 一维数组(简单摇骰子小游戏)
  5. 「WinddowInsets(二)」我们能用WindowInsets做什么?
  6. Data Structures and Algorithms (English) - 6-8 Percolate Up and Down(20 分)
  7. 循环控制语句--for循环
  8. Vue 祖孙方法调用 祖父级方法在孙级调用 祖孙传参
  9. HTML5 实现小车动画效果(Canvas/CSS3/JQuery)
  10. 没有打不了的补丁切不了的面