![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
c or c++ TOJ
IsalphaDemo
一段代码,一段回忆
展开
-
01-package 01背包
2671: 01-package Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Submit: 761 Accepted:289Description给定一个背包的容量k,给定n个物品的体积和价值,物品不可分割,将n个物品中选若干个物品放入背原创 2014-05-03 19:49:16 · 874 阅读 · 0 评论 -
二分匹配模板
bool dfs(int u){ for(int i = 0; i < n; i++) { if(!used[i] && maz[u][i]) { used[i] = true; if(match[i] == -1 || dfs(match[i])) { match[i] = u; return true; } } } return f原创 2014-07-29 15:17:41 · 338 阅读 · 0 评论 -
The Accomodation of Students
L - The Accomodation of StudentsTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionThere are a group of students. Some of them may原创 2014-07-30 18:39:30 · 417 阅读 · 0 评论 -
Bridging signals
在O(n^2)的算法中:创建一个一维数组a[j],dir[],p[j]表示序列的元素,dir[i]表示以第i个元素结尾的序列中的最长下降子序列,初始化为1,对于一个dir[i],遍历前面的每个元素j,如果a[j]>a[i]且dir[j]>=dir[i],那么dir[j]就要加1,在这里,遍历前面的每个元素j,寻找此前最大的子序列时间复杂度为O(n),如果我们在一个有序的序列中查找此前最大的序列长度转载 2014-08-08 13:52:03 · 398 阅读 · 0 评论 -
TOJ 3502: Triangle (pick定理)
3502: Triangle 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte总提交: 187 测试通过:92描述A lattice point is an ordered pair (x, y) where x and y are both integers. Given the c原创 2014-08-20 13:17:38 · 651 阅读 · 0 评论 -
Mathematically Hard (欧拉定理)
Mathematically HardTime Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld & %lluSubmit StatusDescriptionMathematically some problems look hard. But with the help of the co转载 2014-08-20 20:44:57 · 466 阅读 · 0 评论 -
TOJ 1292: 排序 (使用strtok)
1292: 排序 Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Submit: 645 Accepted:322Description输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以原创 2014-08-16 19:24:43 · 491 阅读 · 0 评论 -
Noip
1008: NoipTime Limit:1000MS Memory Limit:32768KByte 64 IO Format:%I64d & %I64uDescription一年一度的noip又开始,选手们比完赛后会在F盘下新建出很多的文件和文件夹。现在我们要根据要求收取其中的文件,请你写个程序帮我们计算一下收到了哪些文件。Input第原创 2014-11-09 14:54:53 · 502 阅读 · 0 评论 -
计算机网络编程作业
编写一个CRC循环冗余校验码生成器。语言不限,界面清晰。具体内容请查看附件。#include#include#include#includeint main(){ int i, j, lenf, leng, k, h,len_ff1; char f[100], g[100], comm[10], yu[100] = {0}, ff1[110] = {0}; while(原创 2014-10-24 16:09:26 · 595 阅读 · 0 评论 -
两个 Goldbach's Conjecture 问题
Goldbach's ConjectureTime Limit: 1000MS Memory Limit: 65536KByte 64 IO Format:%I64d & %I64uDescriptionIn 1742, Christian Goldbach, a German amateur mathematician, sent a letter t原创 2014-10-13 10:48:50 · 509 阅读 · 0 评论 -
TOJ 1504: 计算直线的交点数
1504: 计算直线的交点数 Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Submit: 264 Accepted:129Description平面上有n条直线,且无三线共点,问这些直线能有多少种不同交点数。比如,如果n=2,则可能的交原创 2014-05-28 21:32:47 · 627 阅读 · 0 评论 -
KMP字符串模式匹配详解
刚看到位兄弟也贴了份KMP算法说明,但本人觉得说的不是很详细,当初我在看这个算法的时候也看的头晕昏昏的,我贴的这份也是网上找的。且听详细分解:KMP字符串模式匹配详解来自CSDN A_B_C_ABC 网友KMP字符串模式匹配通俗点说就是一种在一个字符串中定位另一个串的高效算法。简单匹配算法的时间复杂度为O(m*n);KMP匹配算法。可以证明它的时间复杂度为O(m+n).。转载 2014-07-23 13:26:52 · 315 阅读 · 0 评论 -
筛选法求素数
3749: 筛选法求素数 Time Limit(Common/Java):1000MS/3000MS Memory Limit:65536KByteTotal Submit: 544 Accepted:164Description请使用筛选法输出[a, b]之间的所有素数。Input原创 2014-04-15 19:31:48 · 1351 阅读 · 0 评论 -
TOJ:全排列
2621: 全排列 Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Submit: 539 Accepted:171Description任意输入n个不重复的整数序列,输出序列的全排列。Input测试数据有多组,第一行是原创 2014-04-16 20:31:46 · 834 阅读 · 0 评论 -
锥形之阵
3332: 锥形之阵 Time Limit(Common/Java):1000MS/3000MS Memory Limit:65536KByte Total Submit: 287 Accepted:250 Description 锥形之阵,是八阵之一,孙子曾说,锥形之阵,有如一口剑,前锋不尖锐不能突入,左右两翼不锋利不能割裂敌人,...原创 2014-04-13 12:43:01 · 2187 阅读 · 0 评论 -
1501 friends (并查集基本题 by(tzc1329020023))
描述There are some people traveling together. Some of them are friends. The friend relation is transitive, that is, if A and B are friends, B and C are friends, then A and C will become frie原创 2014-04-03 19:58:50 · 641 阅读 · 0 评论 -
3446: Stacking Cylinders
3446: Stacking Cylinders Time Limit(Common/Java):1000MS/3000MS Memory Limit:65536KByteTotal Submit: 60 Accepted:45DescriptionCylinders (e.g. oil drums) (of radius原创 2014-04-20 20:40:37 · 544 阅读 · 0 评论 -
(X * Y) % Z
4423: (X * Y) % Z Time Limit(Common/Java):500MS/1000MS Memory Limit:16387KByteTotal Submit: 63 Accepted:29Description 求 (X * Y) Mod Z的值。其中A Mod B表示A除以B的余数。原创 2014-05-15 19:41:35 · 1849 阅读 · 1 评论 -
TOJ:Least Common Multiple
1070: Least Common Multiple Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Submit: 2644 Accepted:928Description求n个数的最小公倍数。Input输入包含多个原创 2014-04-15 20:55:33 · 419 阅读 · 0 评论 -
DNA Sorting
1903: DNA Sorting Time Limit(Common/Java):1000MS/10000MS Memory Limit:65536KByteTotal Submit: 607 Accepted:347DescriptionOne measure of "unsortedness" in a sequence is原创 2014-06-04 17:18:52 · 576 阅读 · 0 评论 -
Oulipo
E - OulipoTime Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64uSubmit StatusDescriptionThe French author Georges Perec (1936–1982) once wrote a book, La di原创 2014-07-22 12:39:09 · 799 阅读 · 0 评论 -
lightoj1045 - Digits of Factorial
Digits of FactorialTime Limit: 2000MS Memory Limit: 32768KByte 64 IO Format:%lld & %lluDescriptionFactorial of an integer is defined by the following functionf(0) = 1f(n) = f(n - 1原创 2014-10-20 19:58:49 · 538 阅读 · 0 评论