cf803c 数论
细节很多的题
#include<bits/stdc++.h>
using namespace std;
#define ll long long int main(){
ll n,k,tmp,ans=;
cin >> n >> k;
tmp=*n/k/(+k);
if(tmp==) {
puts("-1");
return ;
} for(ll i=;i*i<=n;i++){
if(n%i==){
if(i*i==n){
if(i<=tmp) ans=max(ans,i);
}
else {
if(i<=tmp) ans=max(ans,i);
if(n/i<=tmp) ans=max(ans,n/i);
}
}
}
for(int i=;i<k;i++)
printf("%lld ",ans*i),n-=ans*i;
printf("%lld\n",n); }
cf803c 数论的更多相关文章
- Codeforces Round #382 Div. 2【数论】
C. Tennis Championship(递推,斐波那契) 题意:n个人比赛,淘汰制,要求进行比赛双方的胜场数之差小于等于1.问冠军最多能打多少场比赛.题解:因为n太大,感觉是个构造.写写小数据, ...
- NOIP2014 uoj20解方程 数论(同余)
又是数论题 Q&A Q:你TM做数论上瘾了吗 A:没办法我数论太差了,得多练(shui)啊 题意 题目描述 已知多项式方程: a0+a1x+a2x^2+..+anx^n=0 求这个方程在[1, ...
- 数论学习笔记之解线性方程 a*x + b*y = gcd(a,b)
~>>_<<~ 咳咳!!!今天写此笔记,以防他日老年痴呆后不会解方程了!!! Begin ! ~1~, 首先呢,就看到了一个 gcd(a,b),这是什么鬼玩意呢?什么鬼玩意并不 ...
- hdu 1299 Diophantus of Alexandria (数论)
Diophantus of Alexandria Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java ...
- 【BZOJ-4522】密钥破解 数论 + 模拟 ( Pollard_Rho分解 + Exgcd求逆元 + 快速幂 + 快速乘)
4522: [Cqoi2016]密钥破解 Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 290 Solved: 148[Submit][Status ...
- bzoj2219: 数论之神
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- hdu5072 Coprime (2014鞍山区域赛C题)(数论)
http://acm.hdu.edu.cn/showproblem.php?pid=5072 题意:给出N个数,求有多少个三元组,满足三个数全部两两互质或全部两两不互质. 题解: http://dty ...
- ACM: POJ 1061 青蛙的约会 -数论专题-扩展欧几里德
POJ 1061 青蛙的约会 Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%lld & %llu Descr ...
- 数论初步(费马小定理) - Happy 2004
Description Consider a positive integer X,and let S be the sum of all positive integer divisors of 2 ...
随机推荐
- 学习windows编程 day1
#include <windows.h> #include <strsafe.h> /* 任务:去掉标题栏和边框 */ //#define LineHeight 15 这是自己 ...
- CentOS6.8搭建rabbitmq消息中间件
参考资料:http://blog.csdn.net/yunfeng482/article/details/72853983 一.rabbitmq简介 MQ全称为Message Queue, 消息队列( ...
- HostAliases向Pod中添加hosts解析
前言 根据公司同一个项目需要不同的de/te/pe环境,由于相应环境调用的数据库等配置信息存在不同等因素,需要向Kubernetes集群中的Pod添加对应的hosts解析. 解决 以下以yaml文件自 ...
- PHP7 学习笔记(八)JetBrains PhpStorm 2017.1 x64 MySQL数据库管理工具的使用
填写基本信息 这时候我们可以看到已经连接成功的数据库了 打开一个表,我们可以很清楚的看到数据库表的数据 切换到DDL模式
- C#字体与Rectangle简单对应关系
在1920*1080 无缩放分辨率下,Rectangle要至少是字体的2倍+2才不会被遮挡.
- @ImportResource 导入Spring 的xml配置文件
在配置类尚标注此注解,等同于spring配置文件中的 <import resource="beans.xml"/> Spring Boot里面没有Spring的配置文件 ...
- intellj(idea) 编译项目时在warnings 页签框里 报 “xxx包不存在” 或 “找不到符号” 或 “未结束的字符串字面值” 或 “需要)” 或 “需要;”等错误提示
如上图: 环境 是 刚换的系统,重装的Intellj,直接双击老的皇帝项目中的idea的 .iml文件,结果 打开 intellj 后,进行 ctrl +shift +F9 编译时 尽然报 错误提示, ...
- wcf事务
wcf服务 using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serial ...
- HTML5的学习(三)HTML5标签
3.HTML5新添加的标签 标签 描述 <article> 定义文章. <aside> 定义页面内容之外的内容. <audio> 定义声音内容. <bdi&g ...
- d2-admin中那些不错的技巧
d2-admin基于vue-cli3 路由相关 刷新路由,参照官方 组件内的守卫 但是搞不明白为何加了句 render:h => h() { path: 'refresh', name: 'r ...