Orz。。。不吐槽这次比赛了。。。还是太弱了。。
A. Jzzhu and Children
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
There are n children in Jzzhu's school. Jzzhu is going to give some candies to them. Let's number all the children from 1 to n. The i-th child wants to get at least ai candies.
Jzzhu asks children to line up. Initially, the i-th child stands at the i-th place of the line. Then Jzzhu start distribution of the candies. He follows the algorithm:
- Give m candies to the first child of the line.
- If this child still haven't got enough candies, then the child goes to the end of the line, else the child go home.
- Repeat the first two steps while the line is not empty.
Consider all the children in the order they go home. Jzzhu wants to know, which child will be the last in this order?
Input
The first line contains two integers n,?m (1?≤?n?≤?100; 1?≤?m?≤?100). The second line contains n integers a1,?a2,?...,?an (1?≤?ai?≤?100).
Output
Output a single integer, representing the number of the last child.
Sample test(s)
input
5 21 3 1 4 2
output
input
6 41 1 2 2 3 3
output
Note
Let's consider the first sample.
Firstly child 1 gets 2 candies and go home. Then child 2 gets 2 candies and go to the end of the line. Currently the line looks like [3, 4, 5, 2] (indices of the children in order of the line). Then child 3 gets 2 candies and go home, and then child 4 gets 2 candies and goes to the end of the line. Currently the line looks like [5, 2, 4]. Then child 5 gets 2 candies and goes home. Then child 2 gets two candies and goes home, and finally child 4 gets 2 candies and goes home.
Child 4 is the last one who goes home.
这道题也就这样。。。
#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#include<vector>#include<queue>#define INF 0x3f3f3f3fusing namespace std;int main(){ int n, m; int ans = 0, t = 0, a; cin >> n >> m; for (int i = 0; i > a; if (i == 0 || (a+m-1)/m >= t) { ans = i+1; t = (a+m-1)/m; } } cout <p><br> </p> <p>还有用队列写的。。这个很方便。。</p> <p></p> <pre name="code" class="sycode">#include <bits>using namespace std;const int maxn = 1000 + 10;int n, m;struct node{ int id, cd;};int main(){ int i, j; scanf("%d%d", &n, &m); queue<node> q; for(i=1; im) { cur.cd -= m; q.push(cur); } } printf("%d\n", cur.id); return 0;}</node></bits>
B. Jzzhu and Sequences
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Jzzhu has invented a kind of sequences, they meet the following property:
You are given x and y, please calculate fn modulo 1000000007 (109?+?7).
Input
The first line contains two integers x and y (|x|,?|y|?≤?109). The second line contains a single integer n (1?≤?n?≤?2·109).
Output
Output a single integer representing fn modulo 1000000007 (109?+?7).
Sample test(s)
input
2 33
output
input
0 -12
output
1000000006
Note
In the first sample, f2?=?f1?+?f3, 3?=?2?+?f3, f3?=?1.
In the second sample, f2?=??-?1; ?-?1 modulo (109?+?7) equals (109?+?6).
B题被人HACK了。。。
原来没考虑好为-1的情况。。淡淡的忧桑。。。。
#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#include<vector>#include<queue>#define INF 1000000007using namespace std;int main(){ int x, y; cin>>x>>y; int n; cin>>n; n %= 6; //6次一循环 int a[10]; a[1]=(x+INF) % INF; a[2]=(y+INF) % INF; a[3]=(a[2]-a[1]+INF) % INF; a[4]=(-x+INF) % INF; a[5]=(-y+INF) % INF; a[0]=(a[1]-a[2]+INF) % INF; n = n%6; cout <br> <br> <p></p> <p></p> <p class="sycode"> </p> <p class="sycode"> C. Jzzhu and Chocolate </p> <p class="sycode"> </p> <p class="sycode"> time limit per test </p> 1 second <p class="sycode"> </p> <p class="sycode"> memory limit per test </p> 256 megabytes <p class="sycode"> </p> <p class="sycode"> input </p> standard input <p class="sycode"> </p> <p class="sycode"> output </p> standard output <p class="sycode"> </p> <p> Jzzhu has a big rectangular chocolate bar that consists of n?×?m unit squares. He wants to cut this bar exactly k times. Each cut must meet the following requirements:</p> <li> each cut should be straight (horizontal or vertical);</li> <li> each cut should go along edges of unit squares (it is prohibited to divide any unit chocolate square with cut);</li> <li> each cut should go inside the whole chocolate bar, and all cuts must be distinct.</li> <p> The picture below shows a possible way to cut a 5?×?6 chocolate for 5 times.</p> <p> Imagine Jzzhu have made k cuts and the big chocolate is splitted into several pieces. Consider the smallest (by area) piece of the chocolate, Jzzhu wants this piece to be as large as possible. What is the maximum possible area of smallest piece he can get with exactlyk cuts? The area of a chocolate piece is the number of unit squares in it.</p> <p class="sycode"> </p> <p class="sycode"> Input </p> <p> A single line contains three integers n,?m,?k (1?≤?n,?m?≤?109; 1?≤?k?≤?2·109).</p> <p class="sycode"> </p> <p class="sycode"> Output </p> <p> Output a single integer representing the answer. If it is impossible to cut the big chocolate k times, print -1.</p> <p class="sycode"> </p> <p class="sycode"> Sample test(s) </p> <p class="sycode"> </p> <p class="sycode"> </p> <p class="sycode"> input </p> <pre style="代码" class="precsshei">3 4 1
output
input
6 4 2
output
input
2 3 4
output
-1
Note
In the first sample, Jzzhu can cut the chocolate following the picture below:
In the second sample the optimal division looks like this:
In the third sample, it's impossible to cut a 2?×?3 chocolate 4 times.
#include<cstdio>#include<cstring>#include<algorithm>#include<iostream>#include<vector>#include<queue>#define INF 0x3f3f3f3fusing namespace std;long long int n, m, k;long long int i;int main(){ cin >> n >> m >>k; if( k>n+m-2 ) { cout =b ) b = a; i++; } cout <br> <br> <p></p> <p><br> </p> </queue></vector></iostream></algorithm></cstring></cstdio>

公众号网页更新缓存,这玩意儿,说简单也简单,说复杂也够你喝一壶的。你辛辛苦苦更新了公众号文章,结果用户打开还是老版本,这滋味,谁受得了?这篇文章,咱就来扒一扒这背后的弯弯绕绕,以及如何优雅地解决这个问题。读完之后,你就能轻松应对各种缓存难题,让你的用户始终体验到最新鲜的内容。先说点基础的。网页缓存,说白了就是浏览器或者服务器为了提高访问速度,把一些静态资源(比如图片、CSS、JS)或者页面内容存储起来。下次访问时,直接从缓存里取,不用再重新下载,速度自然快。但这玩意儿,也是个双刃剑。新版本上线,

本文讨论了使用HTML5表单验证属性,例如必需的,图案,最小,最大和长度限制,以直接在浏览器中验证用户输入。

本文展示了使用CSS为网页中添加有效的PNG边框。 它认为,与JavaScript或库相比,CSS提供了出色的性能,详细介绍了如何调整边界宽度,样式和颜色以获得微妙或突出的效果

本文讨论了html&lt; datalist&gt;元素,通过提供自动完整建议,改善用户体验并减少错误来增强表格。Character计数:159

本文讨论了HTML&lt; Progress&gt;元素,其目的,样式和与&lt; meter&gt;元素。主要重点是使用&lt; progress&gt;为了完成任务和LT;仪表&gt;对于stati

本文解释了HTML5&lt; time&gt;语义日期/时间表示的元素。 它强调了DateTime属性对机器可读性(ISO 8601格式)的重要性,并在人类可读文本旁边,增强Accessibilit

本文讨论了HTML&lt; meter&gt;元素,用于在一个范围内显示标量或分数值及其在Web开发中的常见应用。它区分了&lt; meter&gt;从&lt; progress&gt;和前


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

AI Hentai Generator
免费生成ai无尽的。

热门文章

热工具

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中

Atom编辑器mac版下载
最流行的的开源编辑器

Dreamweaver Mac版
视觉化网页开发工具

PhpStorm Mac 版本
最新(2018.2.1 )专业的PHP集成开发工具

SecLists
SecLists是最终安全测试人员的伙伴。它是一个包含各种类型列表的集合,这些列表在安全评估过程中经常使用,都在一个地方。SecLists通过方便地提供安全测试人员可能需要的所有列表,帮助提高安全测试的效率和生产力。列表类型包括用户名、密码、URL、模糊测试有效载荷、敏感数据模式、Web shell等等。测试人员只需将此存储库拉到新的测试机上,他就可以访问到所需的每种类型的列表。