POJ 3094 Quicksum(简单的问题)】的更多相关文章

[简要题意]:题意是非常easy. 看样能理解 [分析]:略. 读取字符串. // 200K 0Ms #include<iostream> using namespace std; int main() { char a[256]; while(1) { int sum = 0; gets(a); if(strcmp(a,"#")==0) break; int len = strlen(a); for(int i = 0;i<len;i++) { if(a[i] ==…
Quicksum Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 16488   Accepted: 11453 Description A checksum is an algorithm that scans a packet of data and returns a single number. The idea is that if the packet is changed, the checksum will…
http://poj.org/problem?id=3094 #include<iostream> #include <string> using namespace std; int main() { string str; getline(cin,str); while(str != "#") { ; ;i < str.length(); i++) { ; if(str[i] >= 'A' && str[i] <= 'Z')…
#include <stdio.h> #include <string.h> ]; int main() { ; int i,len; while(gets(word)) { sum = ; ] == '#') break; len = strlen(word); ; i < len; ++i) { if(word[i] != ' ') sum += (i+) * (word[i]-); } printf("%d\n",sum); } ; }…
结论题,这题关键在于如何转换环,可以用tarjan求出连通分量后再进行标记,也可以DFS直接找到环后把点的SG值变掉就行了 /** @Date : 2017-10-23 19:47:47 * @FileName: POJ 3710 简单环 树上删边 DFS.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : $Id$ */ #i…
Fliptile Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 16558   Accepted: 6056 Description Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in whic…
1.POJ 1260 2.链接:http://poj.org/problem?id=1260 3.总结:不太懂dp,看了题解 http://www.cnblogs.com/lyy289065406/archive/2011/07/31/2122652.html 题意:珍珠,给出需求,单价,要求用最少的钱就可以买到相同数量的,相同(或更高)质量的珍珠. 把握题意,1.输入时,后输入的珍珠价格一定比前面输入的要贵.2.用高质量珍珠替代低质量. #include<iostream> #include…
简单题 #include <iostream> #include <stdio.h> #include <string> #include <stack> #include <map> #include <vector> #include <algorithm> using namespace std; int main() { string s; while(getline(cin, s)) { if (s == &qu…
//题意是 K N, M; //有K个牛 N个牧场,M条路 ,有向的  //把K个牛放到任意的n个不同牧场中,问所有牛都可以到达的牧场数的总和  //这是一道简单的DFS题 //k 100 //n 1000 //m 10000 #include <iostream> #include <cstdio> #include <vector> #include <cstring> using namespace std; int k, n, m; int a[10…
有一家生产酸奶的公司,连续n周,每周需要出货numi的单位,已经知道每一周生产单位酸奶的价格ci,并且,酸奶可以提前生产,但是存储费用是一周一单位s费用,问最少的花费. 对于要出货的酸奶,要不这一周生产,要不提前生产. 什么时候采用什么生产方式呢? 若第i周的货提前生产的话,假设在j周生产,则费用为(i-j)*s+c[j] 若c[i]>(i-j)*s+c[j],则更新c[i]=(i-j)*s+c[j] 更新要O(n^2)? 可以证明,最优的生产方式是,要不在这一周生产,要不在上一周生产(这里的上…