博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ACM-ICPC北京赛区2017网络同步赛
阅读量:6373 次
发布时间:2019-06-23

本文共 4727 字,大约阅读时间需要 15 分钟。

E: Cats and Fish

时间限制:1000ms
单点时限:1000ms
内存限制:256MB

描述

There are many homeless cats in PKU campus. They are all happy because the students in the cat club of PKU take good care of them. Li lei is one of the members of the cat club. He loves those cats very much. Last week, he won a scholarship and he wanted to share his pleasure with cats. So he bought some really tasty fish to feed them, and watched them eating with great pleasure. At the same time, he found an interesting question:

There are m fish and n cats, and it takes ci minutes for the ith cat to eat out one fish. A cat starts to eat another fish (if it can get one) immediately after it has finished one fish. A cat never shares its fish with other cats. When there are not enough fish left, the cat which eats quicker has higher priority to get a fish than the cat which eats slower. All cats start eating at the same time. Li Lei wanted to know, after x minutes, how many fish would be left.

输入

There are no more than 20 test cases.

For each test case:

The first line contains 3 integers: above mentioned m, n and x (0 < m <= 5000, 1 <= n <= 100, 0 <= x <= 1000).

The second line contains n integers c1,c2 … cn,  ci means that it takes the ith cat ci minutes to eat out a fish ( 1<= ci <= 2000).

输出

For each test case, print 2 integers p and q, meaning that there are p complete fish(whole fish) and q incomplete fish left after x minutes.

样例输入
2 1 118 3 51 3 44 5 15 4 3 2 1
样例输出
1 00 10 3

暴力模拟下第几分钟第几条鱼的状态就好了

#include 
using namespace std;struct Node{ int c,s;} a[105];int cmp(Node a,Node b){ return a.c
>m>>n>>x) { for(int i=0; i
>a[i].c,a[i].s=0; sort(a,a+n,cmp); for(int i=1; i<=x; i++) { for(int j=0; j

F: Secret Poems

时间限制:1000ms
单点时限:1000ms
内存限制:256MB

描述

The Yongzheng Emperor (13 December 1678 – 8 October 1735), was the fifth emperor of the Qing dynasty of China. He was a very hard-working ruler. He cracked down on corruption and his reign was known for being despotic, efficient, and vigorous.

Yongzheng couldn’t tolerate people saying bad words about Qing or him. So he started a movement called “words prison”. “Words prison” means literary inquisition. In the famous Zhuang Tinglong Case, more than 70 people were executed in three years because of the publication of an unauthorized history of the Ming dynasty.

In short, people under Yongzheng’s reign should be very careful if they wanted to write something. So some poets wrote poems in a very odd way that only people in their friends circle could read. This kind of poems were called secret poems.

A secret poem is a N×N matrix of characters which looks like random and meaning nothing. But if you read the characters in a certain order, you will understand it. The order is shown in figure 1 below:

            figure 1                                                           figure 2

Following the order indicated by arrows, you can get “THISISAVERYGOODPOEMITHINK”, and that can mean something.

But after some time, poets found out that some Yongzheng’s secret agent called “Mr. blood dripping” could read this kind of poems too. That was dangerous. So they introduced a new order of writing poems as shown in figure 2. And they wanted to convert the old poems written in old order as figure1 into the ones in new order. Please help them.

输入

There are no more than 10 test cases.

For each test case:

The first line is an integer N( 1 <= N <= 100), indicating that a poem is a N×N matrix which consist of capital letters.

Then N lines follow, each line is an N letters string. These N lines represent a poem in old order.

输出

For each test case, convert the poem in old order into a poem in new order.

样例输入
5THSAD IIVOP SEOOH RGETI YMINK2ABCD4ABCDEFGHIJKLMNOP
样例输出
THISIPOEMSDNKIAOIHTVOGYREABDCABEIKHLFNPOCMJGD

本来以为深搜好写,结果写炸了。还是直接for比较稳

#include 
using namespace std;char s[105][105],c[105][105];string c1,c2;int n;void la(){ int j=1,now=0,U=1,D=n,L=1,R=n,i=1,N=n*n; if(N==1) { printf("%c\n",c1[0]); } else { while(now
L&&now
U&&now
>n) { for(int i=1; i<=n; i++) scanf("%s",s[i]+1); c1="",c2=""; for(int i=1; i<=n; i++) if(i%2) { int t=i; for(int j=1; j<=i; j++) { c1+=s[t--][j]; } } else { int t=1; for(int j=i; j>0; j--) { c1+=s[t++][j]; } } for(int i=1; i

 

转载于:https://www.cnblogs.com/BobHuang/p/7865644.html

你可能感兴趣的文章
LimeSDR Getting Started Quickly | LimeSDR上手指南
查看>>
JSP标签JSTL的使用(1)--表达式操作
查看>>
SAP顾问的人脉比技术更为重要
查看>>
FI/CO PA考试试卷
查看>>
汽车介质应用非常严苛?没关系,新技术带来的高精度传感器十分适应!
查看>>
天合光能 - 用计算捕捉“光的能量”
查看>>
使用sysbench压力测试MySQL(一)(r11笔记第3天)
查看>>
css知多少(11)——position
查看>>
【Spring】定时任务详解实例-@Scheduled
查看>>
先有的资源,能看的速度看,不能看的,抽时间看。说不定那天就真的打不开了(转)...
查看>>
哪些领域适合开发微信小程序
查看>>
谁说数据库防火墙风险大?可能你还不知道应用关联防护
查看>>
ASP.NET Core应用针对静态文件请求的处理[2]: 条件请求与区间请求
查看>>
怎样做一个企业?尤其是在这个互联网时代
查看>>
DVNA:Node.js打造的开源攻防平台
查看>>
17个案例带你3分钟搞定Linux正则表达式
查看>>
Java 8 比较器:如何对 List 排序
查看>>
苹果是否步思科后尘折戟中国
查看>>
漏洞预警!微软曝光震网三代漏洞,隔离网面临重大危机
查看>>
协鑫集成第二批1000台E-KwBe光伏储能设备即将启运澳洲
查看>>