NYOJ 158 省赛来了】的更多相关文章

省赛来了 时间限制:1000 ms  |  内存限制:65535 KB 难度: 描写叙述 一年一度的河南省程序设计大赛又要来了. 竞赛是要组队的,组队形式:三人为一队,设队长一名.队员两名. 如今问题就来了,给你m个人,要求每队n个人.求共同拥有几种不同的组队方式. (题目保证m%n等于0,全部数据不超出int范围) 输入 多组測试数据,以EOF结束. 每组測试数据输入两个整数m,n. 输出 对每组測试数据输出不同组队方式的数量(考虑到输出的数可能会非常大,所以请输出对2013取余后的值).并在…
title: 表达式求值 第九届省赛 nyoj 1272 tags: [栈,数据结构] 题目链接 描述 假设表达式定义为: 1. 一个十进制的正整数 X 是一个表达式. 2. 如果 X 和 Y 是 表达式,则 X+Y, XY 也是表达式; *优先级高于+. 3. 如果 X 和 Y 是 表达式,则 函数 Smax(X,Y)也是表达式,其值为:先分别求出 X ,Y 值的各位数字之和,再从中选最大数. 4.如果 X 是 表达式,则 (X)也是表达式. 例如: 表达式 12(2+3)+Smax(333,…
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=168 分析:找到一天中需要最多的房间即可 #include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; #define N 200 int day[N];//day[i] 第i天的最多房间数 int main() { fre…
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=251 规则: 1.若某竞标价唯一,则胜出 2.若不存在唯一竞标价,则投标次数最少竞标价中标,存在多个时,选择价钱最低且最先投此价钱的为中标 #include<iostream> #include<cstdio> #include<cstring> using namespace std; #define N 102 #define M 1002 struct N…
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=170 根据题意,需要找到度数为1的结点个数,如下图: #include<iostream> #include<cstdio> #include<cstring> #include<vector> using namespace std; #define N 10002 vector<int> g[N]; int main() { freo…
#include<iostream> #include<cstdio> #include<algorithm> #include<cstring> using namespace std; #define N 352 /* 重量*单价+重量*距离 = 重量*(距离+单价) 预处理单价 贪心:优先买价格低的 */ struct Node { int p;// p = (单价+距离) int w; }c[N]; bool cmp(Node a, Node b)…
#include <iostream> #include <cstdio> #include <queue> #include <cstring> #include <algorithm> #include <cmath> using namespace std; #define N 1100 #define INF 0x7fffffff bool prime[N]; void init() { memset(prime, true,…
题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=171 动态规划: d(i,j) = max{d(i-1, j), d(i, j-1)}+mp[i][j]; #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<algorithm> using namespace std; #def…
相似与27进制的转换 #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cstdlib> #include<algorithm> #include<stack> using namespace std; int main(){ int t; string s; cin>>t; while(t--) {…
栈的模拟应用: #include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cstdlib> #include<algorithm> #include<stack> using namespace std; string getPostfixExp(string s) { stack<char> sta;// d…