ACM
张志来
这个作者很懒,什么都没留下…
展开
-
hdu2089 不要62
由于一段时间没写代码了,一些基本的函数不会用了,memset(a,0,sizeof(a));对数组初始化为0;还有头文件# include"string".再就是运用到打表的方法,来节省时间。方法;将1到1百万的数遍历一遍有n%10==4或n%100=62的就将a[n]标记为0;没有就标记为1;到时只要将输入的数遍历,看它是否为1,1就加。代码;#include"iostr原创 2012-12-24 18:30:43 · 1934 阅读 · 0 评论 -
Granny's Bike(哈密尔顿回路--深搜,回溯)
Granny's BikeMost days Granny rides her bike around town to do errands, visit, have a cup of coffee, and so on. She enjoys riding her bike and wants to avoid passing the same place twice to add to原创 2013-04-08 17:37:39 · 1062 阅读 · 0 评论 -
Easier Done than Said?(字符串问题)
Easier Done than Said?Password security is a tricky thing. Users prefer simple passwords that are easy to remember (like buddy), but such passwords are often insecure. Some sites use random原创 2013-04-11 13:39:32 · 623 阅读 · 0 评论 -
Climbing Worm(蜗牛爬井问题,递推)
Climbing WormAn inch worm is at the bottom of a well n inches deep. It has enough energy to climb u inches every minute, but then has to rest a minute before climbing again. During the rest,原创 2013-04-11 13:52:10 · 1772 阅读 · 0 评论 -
Least Common Multiple(最小公倍数)
Least Common MultipleThe least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5,原创 2013-04-11 14:04:45 · 1530 阅读 · 0 评论 -
字符串排序
Description在对字符串的排序中,往往具有不同的规则来判断字符串的大小先后。这里有两种比较常见的规则: 1. 首先按字符串长度进行排序,对长度相同的字符串,按字母顺序进行排序。如:ab, gdh, c, gaa, caa排序后的结果是:c, ab, caa, gaa, gdh 2. 直接按字母顺序排序,把长度不同的串都按相同长度处理。如:ab, gdh, c, gaa, caa排序转载 2013-04-14 15:19:02 · 1880 阅读 · 0 评论 -
Gibonacci number
Gibonacci numberIn mathematical terms, the normal sequence F(n) of Fibonacci numbers is defined by the recurrence relationF(n)=F(n-1)+F(n-2)with seed valuesF(0)=1, F(1)=1In this Gibonacc原创 2013-04-22 13:02:28 · 766 阅读 · 0 评论 -
模拟大整数的乘法
由于计算机的位数问题,所以很难处理大数的问题,我根据小学的乘法模拟了大数的乘法。//大整数的乘法 ,模拟 #include"stdio.h"#include"string.h"int aa[100],bb[100],c[200],d[200]; //aa,bb代表字符串转换成整形数组,c数组用来存放每次相乘得到的一个数组 ,d数组用来将每项乘的数相加 int l原创 2013-04-15 15:03:04 · 612 阅读 · 0 评论 -
判断一个点是否在三角形内(面积法,三个点求三角形面积)
1,。如果三角形PAB,PAC和PBC的面积之和与三角形ABC的面积相等,即可判定点P在三角形ABC内(包括在三条边上)。#include"stdio.h"#include"math.h"struct node{int x;int y;}no1[111],no2[1001];double dist(int xa,int ya,int xb,int yb){原创 2013-04-15 20:51:29 · 3668 阅读 · 0 评论 -
Clairewd’s message(密文转换)
Clairewd’s messageProblem DescriptionClairewd is a member of FBI. After several years concealing in BUPT, she intercepted some important messages and she was preparing for sending it to ykwd.原创 2013-04-16 20:02:24 · 3422 阅读 · 0 评论 -
Dijkstra算法
#include #include #define MAX_LEN 100#define INFINITE 1000typedef struct graph{ int nodenum; int edgenum; int matrix[MAX_LEN][MAX_LEN];}Graph;typedef struct stack{转载 2013-04-25 09:30:23 · 489 阅读 · 0 评论 -
Red and Black(广搜,迷宫)
Red and BlackProblem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to o转载 2013-04-25 09:02:22 · 593 阅读 · 0 评论 -
Tempter of the Bone(深搜,回溯)
Tempter of the BoneProblem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel转载 2013-04-25 09:43:16 · 475 阅读 · 0 评论 -
连连看(BFS)
连连看Problem Description“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经转载 2013-04-25 10:52:41 · 744 阅读 · 1 评论 -
hdu 1232畅通工程(DFS)
畅通工程Problem Description某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路? Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分原创 2013-03-24 10:16:49 · 572 阅读 · 0 评论 -
最小生成树(kruskal&prim)畅通工程
畅通工程Problem Description省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可)。经过调查评估,得到的统计表中列出了有可能建设公路的若干条道路的成本。现请你编写程序,计算出全省畅通需要的最低成本。Input测试输入包含若干测试用例。每个测试用例的第1行给出评估的道路条数 N、村庄数目M原创 2013-03-22 13:54:33 · 671 阅读 · 0 评论 -
Email code
Email codeProblem Description在很久很久以前进行通信没有网络,更没有我们现在的所谓的键盘,所以以前通信只能利用打点机,该打点机只能打出同一个频率的信号,然后被对方接收,这里我们称它为字符。比如denglaixianatgmaildotcom,现在你的任务是把它改造成一个正确的邮件地址(denglaixian@gmail.com)。众所周知,一个正确的原创 2013-03-19 19:55:56 · 2798 阅读 · 0 评论 -
zoj 1001纪念我的第一个java ACM题
import java.util.Scanner;public class Main {public static void main(String arg[]){Scanner scin=new Scanner(System.in);while(scin.hasNextInt()){int a=scin.nextInt();int b=scin.nextInt();S原创 2012-12-24 19:07:15 · 983 阅读 · 0 评论 -
FZU 1057
Problem 1057 abDescription对于任意两个正整数a,b(0b各位数字的和的各位数字的和的各位数字的和的各位数字的和。Input输入有多组数据,每组只有一行,包含两个正整数a,b。最后一组a=0,b=0表示输入结束,不需要处理。Output对于每组输入数据,输出ab各位数字的和的各位数字的和的各位数字的和的原创 2013-03-04 10:36:07 · 891 阅读 · 0 评论 -
FZU 1075 分解素因子
分解素因子Description假设x是一个正整数,它的值不超过65535(即1Input输入的第一行含一个正整数k (1Output每个测试例对应一行输出,输出x的素数乘积表示式,式中的素数从小到大排列,两个素数之间用“*”表示乘法。Sample Input2119828原创 2013-03-04 17:17:19 · 1260 阅读 · 0 评论 -
hdu 2092(java)
整数解Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14768 Accepted Submission(s): 5084Problem Description有二个整数,它们加起来等于某个整数,乘起来又等于另一个整数原创 2013-03-02 14:20:42 · 951 阅读 · 0 评论 -
hdu1005 ( Number Sequence )
由于mod7,所以所有的数f(n)都是0~6这7个数的一个,那么对于f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7,f[n-1]和f[n-2]的这两个数的组合一共有7*7=49可能(就是两个数字的组合,每个数有7种可能(0到6),比如0和1,6和5,4和2),那么如果f[i-1]和f[i-2]的值为m和n,继续算下去,在49次运算之内,肯定会出现f[j-1]和转载 2013-03-03 19:42:41 · 352 阅读 · 0 评论 -
hdu 1999不可摸数
不可摸数Problem Descriptions(n)是正整数n的真因子之和,即小于n且整除n的因子和.例如s(12)=1+2+3+4+6=16.如果任何数m,s(m)都不等于n,则称n为不可摸数.Input包含多组数据,首先输入T,表示有T组数据.每组数据1行给出n(2Output如果n是不可摸数,输出yes,否则输出noSampl原创 2013-03-14 20:38:48 · 4605 阅读 · 1 评论 -
hdu 2736Surprising Strings
Surprising StringsProblem DescriptionThe D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of its D-pairs are dif原创 2013-03-14 20:27:42 · 1413 阅读 · 0 评论 -
Prime Distance(大素数筛选)
The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of primali原创 2013-03-28 20:22:27 · 755 阅读 · 0 评论 -
hdu 2212 DFS
DFsProblem DescriptionA DFS(digital factorial sum) number is found by summing the factorial of every digit of a positive integer. For example ,consider the positive integer 145 = 1!+4!+5!,原创 2013-03-15 20:55:54 · 969 阅读 · 0 评论 -
Hard to Believe, but True!(大数加法的模板和atoi()的应用)
Hard to Believe, but True!The fight goes on, whether to store numbers starting with their most significant digit or their least significant digit. Sometimes this is also called the "Endian原创 2013-03-30 11:05:23 · 626 阅读 · 0 评论 -
统计难题(字典树的应用)
统计难题Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单词,一个空行代表单词表的结原创 2013-03-31 09:28:10 · 534 阅读 · 0 评论 -
Guessing Game
Guessing GameStan and Ollie are playing a guessing game. Stan thinks of a number between 1 and 10 and Ollie guesses what the number might be. After each guess, Stan indicates whether Ollie原创 2013-03-31 15:52:15 · 1580 阅读 · 0 评论 -
一道简单题
一道简单题Problem Description有一道小学题对我印象一直比较深刻,大概是十年前吧那时我读小学六年级,数学老师带了我们几个数学学得还好的同学去参加区数学奥林匹克竞赛,在考场上这题当时就把我给难住了,也就是因为这题竞赛只得了第二,与第一擦肩而过,所以对这题对我来说一直印象很深,现在拿出来让大家热热身,不要想复杂了,当做娱乐就好。当时题目是这样描述的:现有“★”和“☆原创 2013-03-19 20:37:30 · 506 阅读 · 0 评论 -
Push Box
Push BoxProblem DescriptionPush Box is a classic puzzle game. This game play in a grid, there are five types of block in it, the player, the box, the hole, empty place, and the wall. In ever转载 2013-04-21 15:03:46 · 806 阅读 · 0 评论