自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(65)
  • 资源 (2)
  • 收藏
  • 关注

原创 循环-01. 求整数段和(15)

#include #include #include #include using namespace std;int main(){ stringstream ss; int a,b; cin>>a>>b; int i=0; int sum=0; int tmp=a; string tmp1; int size;

2014-08-11 17:37:34 697

原创 字符串-07. 说反话-加强版 (20)

#include #include #include using namespace std;int main(){ stack s; string sp; bool flag=false; while(cin>>sp) s.push(sp); while(!s.empty()) { if(fla

2014-08-11 17:20:37 2125

原创 字符串-06. IP地址转换(20)

#include #include #include using namespace std;int transfer(string s){ int num=0; for(int i=0;i<8;i++) { num+=(s[i]-'0')*pow(2,7-i); } return num;}int main(){

2014-08-11 16:20:52 372

原创 字符串-05. 字符串循环左移(20)

#include #include using namespace std;int main(){ string s; getline(cin,s); int n; cin>>n; while(n--){ s=s.substr(1)+s[0]; } cout<<s<<endl;}

2014-08-11 16:10:02 314

原创 字符串-03. 字符串的冒泡排序(20)

#include #include using namespace std;int main(){ int n,k; cin>>n>>k; string s[101]; for(int i=0;i<n;i++) { cin>>s[i]; } string tmp; for(int i=0;i<k;i++)

2014-08-11 15:40:46 458

原创 字符串-02. 删除字符串中的子串(20)

#include #include using namespace std;int main(){ string s1,s2; getline(cin,s1); getline(cin,s2); while(s1.find(s2)!=string::npos) s1.erase(s1.find(s2),s2.length()); co

2014-08-11 10:51:32 557

原创 字符串-01. 在字符串中查找指定字符(15)

#include #include using namespace std;int main(){ string s; char c; getline(cin,s); cin>>c; if(s.find(c)!=string::npos) cout<<s.substr(s.find(c))<<endl; else

2014-08-11 10:45:00 519

原创 字符串-04. 字符串逆序(15)

#include #include #include using namespace std;int main(){ string a; getline(cin,a); reverse(a.begin(),a.end()); cout<<a<<endl;}

2014-08-11 10:39:43 339

原创 1083. List Grades (25)

#include #include #include #include using namespace std;struct Student{ string name; string id; int grade;};bool cmp(Student a,Student b){ return a.grade>b.grade;}int ma

2014-08-08 01:43:13 401

原创 1070. Mooncake (25)

#include #include #include #include using namespace std;struct Mooncake{ double Inventory; double Prices; double PerPrice;};bool cmp(Mooncake a,Mooncake b){ return a.PerPr

2014-08-06 11:23:36 331

转载 1068. Find More Coins (30)

F(N, M) = max{ F(N–1, M), F(N–1, M–c(N)) + c(N) },c(N)表示第N个硬币的面值

2014-08-05 23:43:37 332

原创 1063. Set Similarity (25)

#include #include #include #include using namespace std;struct person{ char number[9]; int vg; int tg; int sum;};/*bool cmp(person a,person b){ if(a.tg+a.vg!=b.tg+b.vg)

2014-07-24 15:22:28 296

原创 1059. Prime Factors (25)

#include #include #include #include #include //#include using namespace std;struct factor{ long int fac; long int geshu;}fa[1000001];bool prime(long int n){ if(n==1) return false; e

2014-07-23 23:45:03 415

原创 1058. A+B in Hogwarts (20)

#include #include struct qian { int GAL; int SIC; int KNU;};int main(){qian A;qian B,C; scanf("%d.%d.%d",&A.GAL,&A.SIC,&A.KNU); scanf("%d.%d.%d",&B.GAL,&B.SIC,&B.KNU); C.KNU=A.KNU

2014-07-23 22:45:08 333

原创 1055. The World's Richest (25)

#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;struct tuhao{ string name; int age; int worth;};tuhao a[10001];

2014-07-23 10:28:12 323

原创 1081. Rational Sum (20)

#include #include #include using namespace std;long long int gcd(long long int a,long long int b){ if(a%b==0) return b; else return gcd(b,a%b);}long long int lcm(long long in

2014-07-23 00:39:12 568

原创 1028. List Sorting (25)

//// main.cpp// pat//// Created by hcw on 14-7-18.// Copyright (c) 2014年 hcw. All rights reserved.//#include #include #include #include #include #include using namespace std;struct

2014-07-18 09:43:20 286

转载 已知二叉树的前序/后序遍历和中序遍历,求后序/前序遍历

前序遍历:1、访问根节点2、前序遍历左子树3、前序遍历右子树中序遍历:

2014-07-15 00:45:43 440

转载 PAT1013. Battle Over Cities (25)

原题要求计算出图去掉一个node以后连通分量的个数可以用DFS算法或者也可以用并查集DFS算法

2014-07-08 00:53:50 388

原创 STL vector学习+PAT 1077

太水了最近 快期末了。

2014-06-09 19:33:54 440

转载 容器 deque的例子

/*deque特性下标:.operator[](i)不检查越界,.at(i) 删除:.pop_front(),.pop_back()*/#includeusing namespace std;#include#include "print.h"int main(){ deque dq; dq.push_back('c'); dq.push_back('d'); dq.p

2014-05-21 22:18:32 501

原创 1065. A+B and C (64bit) (20)

PAT 1065 和乙级相比,需要考虑溢出的问题A与B同正或同负时,可能发生溢出。当a>=0 b>=0时,若a+bc当a0,则a+b其余情况可直接比较,long和int虽然在32位系统里都表示4个字节,32位数,但需要考虑不同平台下。long的长度不小于int的长度。#include bool cmp(long long

2014-03-21 12:02:46 524

转载 Sort函数的用法

STL里面有个sort函数,可以直接对数组排序,复杂度为n*log2(n)。使用这个函数,需要包含头文件。 这个函数可以传两个参数或三个参数。第一个参数是要排序的区间首地址,第二个参数是区间尾地址的下一地址。也就是说,排序的区间是[a,b)。简单来说,有一个数组int a[100],要对从a[0]到a[99]的元素进行排序,只要写sort(a,a+100)就行了,默认的排序方式是升序。

2014-03-12 22:52:17 508

原创 ZOJ 1048

水题#include int main(){ float a[12]; int i=0;float sum=0; for(i=0;i<12;i++){ scanf("%f",&a[i]); sum=sum+a[i];}printf("$");printf("%.2lf",sum/12);return 0;}

2014-03-11 21:41:21 395

原创 ZOJ 1037 Gridland

原来以为是最小路径。。看了网上的题解发现是水题。。

2014-03-11 21:04:37 496

计算机体系结构量化研究方法第五版答案(包括附录)

计算机体系结构量化研究方法第五版答案(包括附录),很全面的资料。

2015-05-24

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除