随笔分类 - 算法
一些简单有趣算法
摘要:转载:http://www.jianshu.com/p/42f81846c0fb?hmsr=toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io 一、概述 以前看到这样一句话,语言只是工具,算法才是程序设计的灵魂。的确,算法在计算机科学中的地位
阅读全文
摘要:问题:One day when you are going to clear all your browsing history, you come up with an idea: You want to figure out what your most valued site is. Ever...
阅读全文
摘要:问题:Do you remember our children time? When we are children, we are interesting in almost everything around ourselves. A little thing or a simple game ...
阅读全文
摘要:问题:You are given the side lengths of a triangle, determine is it an acute triangle, right triangle or obtuse triangle.InputThe first line contains an ...
阅读全文
摘要:问题:sevenzero liked Warcraft very much, but he haven't practiced it for several years after being addicted to algorithms. Now, though he is playing wit...
阅读全文
摘要:问题:Alice and Bob are playing a kind of special game on an N*M board (N rows, M columns). At the beginning, there are N*M coins in this board with one ...
阅读全文
摘要:问题:Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the...
阅读全文
摘要:问题:A straight dirt road connects two fields on FJ's farm, but it changes elevation more than FJ would like. His cows do not mind climbing up or down a...
阅读全文
摘要:问题:As more and more computers are equipped with dual core CPU, SetagLilb, the Chief Technology Officer of TinySoft Corporation, decided to update thei...
阅读全文
摘要:问题:给定N个节点,能构成多少种不同的二叉树.回答:卡特兰数运用.import java.util.*;import java.math.*;public class Main{ public static void main(String[] args) { int n; Scanner in=...
阅读全文
摘要:问题:On Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is playe...
阅读全文
摘要:问题:有N个小孩围成一圈,给他们从1开始依次编号,现指定从第W个开始报数,报到第S个时,该小孩出列,然后从下一个小孩开始报数,仍是报到S个出列,如此重复下去,直到所有的小孩都出列(总人数不足S个时将循环报数),求小孩出列的顺序。Input第一行输入小孩的人数N(N#include #include ...
阅读全文
摘要:问题:As an experienced ACMer, you must have known the importance of "code template library". With the help of pre-printed code library, you can implemen...
阅读全文
摘要:问题:In your childhood, do you crazy for collecting the beautiful cards in the snacks? They said that, for example, if you collect all the 108 people in...
阅读全文
摘要:问题:给出一个数,计算出其全排列结果。回答:方法一:#include #include #include #define maxN 4using namespace std; int main(){ int p[maxN] = {-1}; for(int i=0; i#include //#def...
阅读全文
摘要:问题:Biologists finally invent techniques of repairing DNA that contains segments causing kinds of inherited diseases. For the sake of simplicity, a DNA...
阅读全文
摘要:问题:Candy and his friends found a treasure map. With the help of the map, they successfully found the treasure inside an ancient cave, but just as they...
阅读全文
摘要:问题:John is going on a fishing trip. He has h hours available (1 = 0 ), is known. Each 5 minutes of fishing decreases the number of fish expected to be...
阅读全文
摘要:问题:Input输入的第一行是一个整数T( 1 #include #include #include #includeusing namespace std;#define M 2005int a[M][26],b[26];vectorQ;void main(){ int T; scanf("%d"...
阅读全文
摘要:问题:In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryptio...
阅读全文

浙公网安备 33010602011771号