- 浏览: 12636 次
- 性别:
- 来自: 广州
最新评论
文章列表
1010. Zipper
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
Given three strings, you are to determine whether the third string can be formed by combining the characters in the first two strings. The first two strings can be mixed arbitrarily, but each must stay in its origin ...
1007. To and Fro
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
Mo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letters only) down the columns, padding with extra random letters so as to make ...
本博客已经搬迁至CSDN 链接为:http://blog.csdn.net/linxiao2011
1625. Binary Clock
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
A binary clock is a clock which displays traditional sexagesimal time (military format) in a binary format. The most common binary clock uses three columns or three rows of LEDs to represent zeros and on ...
1155. Can I Post the lette
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
I am a traveler. I want to post a letter to Merlin. But because there are so many roads I can walk through, and maybe I can’t go to Merlin’s house following these roads, I must judge whether I ca ...
1198. Substring
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
Dr lee cuts a string S into N pieces,s[1],…,s[N].
Now, Dr lee gives you these N sub-strings: s[1],…s[N]. There might be several possibilities that the string S could be. For example, if Dr. lee gives yo ...
1122. Prerequisites?
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
Freddie the frosh has chosen to take k courses. To meet the degree requirements, he must take courses from each of several categories. Can you assure Freddie that he will graduate, based on his course sel ...
一道很典型的最短路径的题目。
算法的思想来自于Dijkstra(迪杰斯特拉)算法,大家在这里对这个算法就不介绍了。
可以在学完最短经的算法后,用这道题目当做练手。。我的算法还需要优化一下,代码也需要优化,因为我的代码确实有点乱。。下面的代码仅供参考。。
题目的链接:http://soj.me/1703
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>
#inc ...
其实,这道题目的意思简单的。
大概的意思就是,把找到每一个字符串出现的次数,然后,按照字典顺序把字符串和出现的次数依次输出来。。
题目的链接: http://soj.me/1825
下面是我的代码,还有优化的需要,通过的时间为2.3S,题目限定的时间为3S
#include <iostream>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <cctype&g ...
1321. Robot
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
Karell Incorporated has designed a new exploration robot that has the ability to explore new terrains, this new robot can move in all kinds of terrain, it only needs more fuel to move in rough terrains, and less fuel ...
1940. Ordering Tasks
Constraints
Time Limit: 1 secs, Memory Limit: 32 MB
Description
John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed.
Input
There are multiple test cases. The f ...
鉴于这道题目的数据量并不大,所以,暴力解决就可以啦。。
所谓暴力,也就说,三重循环。。
题目的链接: http://soj.me/6135
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int n, m;
int count = 1;
while (scanf("%d%d", &n, &m) != EOF)
{
int max = -1;
...
这道题目,其实不用怎么想,数据有大,不过一次遍历搜索就可以完成。
首先读入数据,储存在数组中,然后从数组的尾部向前面搜索判断,就可以了。。
#include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int t;
int n, m;
int r, c, w, h, cr, cc;
int left[109];
int right[109];
int top[109];
int ...