C

直接把第一次加在哪里for一遍即可

/*Huyyt*/
#include<bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int dir[][] = {{, }, {, }, {, -}, { -, }, {, }, {, -}, { -, -}, { -, }};
const int mod = 1e9 + , gakki = + + + + 1e9;
const int MAXN = 2e5 + , MAXM = 2e5 + , N = 2e5 + ;
const int MAXQ = ;
/*int to[MAXM << 1], nxt[MAXM << 1], Head[MAXN], tot = 1;
inline void addedge(int u, int v)
{
to[++tot] = v;
nxt[tot] = Head[u];
Head[u] = tot;
}*/
inline void read(int &v)
{
v = ;
char c = ;
int p = ;
while (c < '' || c > '')
{
if (c == '-')
{
p = -;
}
c = getchar();
}
while (c >= '' && c <= '')
{
v = (v << ) + (v << ) + c - '';
c = getchar();
}
v *= p;
}
int num[];
int main()
{
int n;
int k;
int minn = INT_MAX;
int aim;
read(n), read(k);
for (int i = ; i <= n; i++)
{
read(num[i]);
if (num[i] < minn)
{
minn = num[i];
aim = i;
}
}
int ans = ;
ans = INT_MAX;
int anser = ;
for (int laim = max(, aim - k + ); laim <= aim; laim++)
{
int raim = min(n, laim + k - );
anser = ;
if ((laim - ) % (k - ))
{
anser++;
}
anser += (laim - ) / (k - );
if ((n - raim) % (k - ))
{
anser++;
}
anser += (n - raim) / (k - );
ans = min(ans, anser);
}
cout << ans << endl;
return ;
}

正解:

    scanf("%d%d",&n,&k);
printf("%d\n",(n-)/(k-)+);

(直接(n-1)/(k-1)向上取整即可 感觉自己是个弱智

D

打表找规律

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
double Snuke(ll x)
{
ll tmp = , c = x;
while (c)
{
tmp += c % ;
c /= ;
}
return 1.0 * x / tmp;
}
int main()
{
int K;
cin >> K;
ll res = , x = ;
while (K--)
{
double t1, t2;
while (true)
{
t1 = Snuke(res + x), t2 = Snuke(res + x * );
if (t1 <= t2)
{
break;
}
x *= ;
}
res += x;
printf("%lld\n", res);
}
return ;
}

E

背包

最新文章

  1. R语言 三个函数sort();rank();order()
  2. Android Studio 打包签名发布New Key Store
  3. Oracle 安装后关于用户
  4. mac下用ruby安装sass &amp;&amp; webstorm下给scss文件添加watch
  5. UI特效--Android利用ViewFlipper实现屏幕切换动画效果
  6. 如何优化 Android Studio 启动、编译和运行速度?
  7. ASP.NET MVC概述
  8. 自动生成XML空节点格式的差异
  9. hibernate 插入数据时让数据库默认值生效
  10. 用python进行应用程序自动化测试(uiautomation)
  11. 【PAT】 B1006 换个格式输出整数
  12. byte[] 解析、转码二三事
  13. 安卓开发-设置RadioButton的点击效果
  14. robots.txt、humans.txt、.editorconfig、.gitignore、LICENSE.txt、README.md、CHANGLOG.md
  15. opencv-Python---动态人脸捕捉
  16. 删除N天前的备份文件脚本(windows)
  17. Java-性能调优实战(jps、jstack)
  18. [How to]使用自定义cell进行tableview的创建,适用于cell样式不发生变化的情况。
  19. hive自带的字符串函数
  20. BZOJ4654/UOJ223 [Noi2016]国王饮水记

热门文章

  1. SQL Server 等待统计信息基线收集
  2. &#39;caching_sha2_password&#39; cannot be loaded
  3. python学习之数据类型(int,bool,str)
  4. web题
  5. Analysis Methods in Neural Language Processing: A Survey
  6. MSSQL 索引
  7. C++练习 | 不使用头插法逆转单链表
  8. 从入门到自闭之Python名称空间
  9. k8s 1.9安装
  10. Codeforces 1221E. Game With String