CodeForces - 796B 模拟】的更多相关文章

思路:模拟移动即可,如果球落入洞中停止移动.注意:有可能第一个位置就是洞!! AC代码 #include <cstdio> #include <cmath> #include <cctype> #include <algorithm> #include <cstring> #include <utility> #include <string> #include <iostream> #include <…
Prison Transfer Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description The prison of your city has n prisoners. As the prison can't accommodate all of them, the city mayor has decided to transfer c of t…
Marathon Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Valera takes part in the Berland Marathon. The marathon race starts at the stadium that can be represented on the plane as a square whose…
B. Checkpoints time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Vasya takes part in the orienteering competition. There are n checkpoints located along the line at coordinates x1, x2, ..., x…
[题目链接]:http://codeforces.com/contest/796/problem/B [题意] 一开始骨头在1号位置; 然后有m个洞,给出洞的下标; 然后有k个交换操作; 如果骨头到洞里了,就不能再交换了; 骨头就一直待在洞的下标位置; 问你k个操作后骨头在哪里 [题解] 用个一维数组模拟; 1代表骨头,0代表不是骨头; 然后开个map记录哪里是洞; 如果骨头到洞里面去了;就结束; 否则输出k次操作后1的下标就好了 [Number Of WA] 0 [完整代码] #include…
Valera and X Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the Engli…
Inna and Alarm Clock Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Inna loves sleeping very much, so she needs n alarm clocks in total to wake up. Let's suppose that Inna's room is a 100 × 100 …
题意: 给你k件衣服处理,告诉你洗衣机烘干机折叠机的数量,和它们处理一件衣服的时间,要求一件衣服在洗完之后必须立刻烘干,烘干之后必须立刻折叠,问所需的最小时间. 思路: 1.按照时间模拟 2.若洗完的衣服或者烘干的衣服较多来不及进行下一个步骤,则从一开始就顺延洗衣服的时间,贪心的思想也是体现在这里. 3.关键在于烘干衣服的顺延如何处理,因为需要调整洗衣服的起始时间,其实我们只要对烘干衣服的时间进行顺延处理就可以了,因为即使没有调整洗衣服的起始时间,那么下次到了烘干衣服的时间的时候因为烘干衣服的数…
https://vjudge.net/problem/CodeForces-864C 题意:两地之间有个加油站,往返走k个单程,最少加油多少次. 大佬几十行代码就解决,我却要用一百多行的if语句模拟解决. #include<stdio.h> #include<iostream> #include<algorithm> #include<cstring> #include<math.h> #include<string> #includ…
C. Letters Cyclic Shift time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty su…