码迷,mamicode.com
首页 >  
搜索关键字:cin getline    ( 8174个结果
449A - Jzzhu and Chocolate 贪心
一道贪心题,尽量横着切或竖着切,实在不行在交叉切 #include #include using namespace std; int main(){ // freopen("in.txt","r",stdin); long long n,m,k; while(cin>>n>>m>>k){ if((n+m-2)<k){ printf...
分类:其他好文   时间:2014-07-22 22:38:53    阅读次数:160
卡片游戏(队列)
#include #include using namespace std; queueq; int main() { int n; cin>>n; for(int i=1;i<=n;i++) q.push(i); while(!q.empty()) { cout<<q.front()<<' '; q.pop(); if(!q.empty()) ...
分类:其他好文   时间:2014-07-22 22:34:33    阅读次数:179
D. Multiplication Table 二分查找
刚做这道题根本没想到二分,最关键是没想出来如何统计在这个矩阵中比一个数小的有几个怎么算,造成自己想了好久最后看了别人的提示才做出来。哎!好久不做题太弱了 #include #include using namespace std; int main(){ // freopen("in.txt","r",stdin); long long n,m,k; while(cin>>...
分类:其他好文   时间:2014-07-22 22:33:55    阅读次数:192
素数槽csuoj
超时代码:#include using namespace std;//写一个函数判断是否是素数bool isPrime(int num){int i=2;//coutnum)return true; else return false;}int main(){ int T; cin>>...
分类:其他好文   时间:2014-07-21 10:01:49    阅读次数:246
Codeforces Round #258 (Div. 2)
A - Jzzhu and Children找到最大的ceil(ai/m)即可#include #include using namespace std;int main(){ int n,m; cin >> n >> m; double a, maxv = 0; int m...
分类:其他好文   时间:2014-07-21 09:39:57    阅读次数:327
UVA 10036
dp题目,dp[i][j]=1表示前i个数字形成的表达式的值除以K之后可以余j#include #include using namespace std;int dp[10001][101];int a[10001];int main(){ int m,n,k,u; while(cin>>m){ w...
分类:其他好文   时间:2014-07-21 09:39:06    阅读次数:154
Vijos P1000 A+B Problem
描述输入两个自然数,输出他们的和格式输入格式两个自然数x和y (0using namespace std;int main(){ int a,b; cin>>a>>b; cout<<(a+b)<<endl; return 0;}
分类:其他好文   时间:2014-07-21 00:25:43    阅读次数:182
最长公共上升子序列(LCIS)ZOJ 2432
立方算法: #include #include #include #include #define M 505 using namespace std; typedef long long LL; LL a[M],b[M]; int dp[M][M]; int main() { //freopen("in.txt","r",stdin); int T; cin>>T; ...
分类:其他好文   时间:2014-07-20 23:01:50    阅读次数:284
杭电acm 2095 find your present (2)
#includeusing namespacestd;intmain(){ intn,x,y; while(cin>>n,n) { cin>>x; while(--n) { cin>>y; x=x^y; } cout<<x<<"\n"; } return0;}
分类:其他好文   时间:2014-07-20 21:30:54    阅读次数:230
【文本处理】awk、sed使用 - 二
一些例子。1、显示gopher帐号所在行至最后一行。awk‘/^gopher/{row=NR;while(getline<"passwd"){++i;FS=":";if(i>=row){print$0}}}‘passwdgetline<"filename"若读取成功,则返回非0,当读文件完后,会返回0。awk-F:‘NR==FNR{if($1~/^gopher/){row=NR};next}{if(FNR>..
分类:其他好文   时间:2014-07-20 15:31:51    阅读次数:353
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!