poj刷题
Chailyn_Trista
这个作者很懒,什么都没留下…
展开
-
POJ百练 2018研究生上机测试A(回文数)
结束后不能在线评测。欢迎指正。#include<cstdio>#include<stdio.h>#include<cstdlib>#include<sstream>#include<iostream>#include<string>#include<cstring>#include<algorithm原创 2018-07-08 16:49:08 · 329 阅读 · 0 评论 -
POJ 2586
贪心?列举法#include<iostream>using namespace std;int main(){ long long s,d,tsum,sum; while(scanf("%lld %lld",&s,&d)!=EOF){ int i; for(i=1;i<=5;++i){ tsum=(5-i)*s-i*d; if(ts...原创 2018-07-11 20:30:51 · 168 阅读 · 0 评论 -
POJ 3006 素数
#include<iostream>#include<cstring>///memset#define top 1000001using namespace std;bool isPrime[top];void getIsPrime(){ memset(isPrime,true,top);//按字节初始化 isPrime[0]=isPrime[1]=fa...原创 2018-07-11 17:53:55 · 166 阅读 · 0 评论 -
POJ 3253 哈夫曼树 优先队列
借助stl的priority_queue实现哈夫曼树的思想。换成__int64后AC#include<iostream>#include<queue>using namespace std;int main(){ __int64 n,k; cin>>n; priority_queue<__int64,vector<__int64>...原创 2018-07-11 16:46:39 · 189 阅读 · 0 评论 -
POJ 1804 归并排序 求逆序数
借助归并的解法 结果TLE#include<iostream>#include<vector>using namespace std;int count;void merge(vector<int>sr,vector<int>&r,int s,int m,int e){ int k=s,i=s,j=m; for(;i<m&a...原创 2018-07-11 08:56:58 · 194 阅读 · 0 评论 -
POJ 2388 随机快排
随机快排,寻找第k大的数(当然包括中位数啦注意随机数rand()需要#include<cstdlib>qsort 的return条件有点小变化#include<iostream>#include<vector>#include<cstdlib>//rand()using namespace std;int quicksort(vector&...原创 2018-07-10 21:16:56 · 200 阅读 · 0 评论 -
POJ 1007 求逆序数 快排
我自己的思路,顺便复习快排#include<iostream>#include<string>#include<vector>using namespace std;int getcount(string s,int len){//求逆序数 int count=0; for(int i=1;i<len;++i){ for(int j=0;...原创 2018-07-10 18:18:50 · 749 阅读 · 0 评论 -
POJ 1016 串
Time Limit Exceeded why???#include<iostream>#include<algorithm> #include<sstream>using namespace std;string calInv(string s){ int len=s.size();///>1 string res; sort(&am...原创 2018-07-10 09:41:34 · 169 阅读 · 0 评论 -
POJ 2159
#include<iostream>#include<algorithm>#include<vector>#include<string>using namespace std;void countfreq(string s,vector<int>& freq){ int len=s.size(),count=1; ...原创 2018-07-09 17:42:53 · 235 阅读 · 0 评论 -
POJ 3299
#include<iostream>#include<cmath>#define exp 2.718281828using namespace std;float geth(float t,float d){ float h,e; e=6.11*pow(exp,5417.7530*((1/273.16)-(1/(d+273.16)))); h=0.5555*...原创 2018-07-09 10:59:09 · 342 阅读 · 0 评论 -
POJ 1207
暴力 题目简直坑#include<iostream>using namespace std;int main(){ int x,y,max,count,k; while(scanf("%d %d",&x,&y)!=EOF){ cout<<x<<" "<<y<<" "原创 2018-07-09 09:47:16 · 316 阅读 · 0 评论 -
POJ 1005
#include<iostream>#include<cmath>#define PI 3.1415926using namespace std;int main(){ int n; cin>>n; float x,y,r,area; int year; for(int i=0;i<n;++i){ cin>>x>&g...原创 2018-07-08 23:50:17 · 156 阅读 · 0 评论 -
POJ 1003
#include<iostream>using namespace std;int main(){ float c; while(cin>>c,c!=0.00){ int k=2; float sum=0.0; sum+=1.0/k; while(sum<c){ k+=1; sum+=1.0/k; } cout<&...原创 2018-07-08 17:39:36 · 152 阅读 · 0 评论 -
POJ 1837 动态规划
完全参考 这篇博客#include<iostream>#include<cstring>using namespace std;int dp[21][150001];////int main(){ int C,G; cin>>C>>G; int *c=new int[C+1]; int *g=new int[G+1]; for(...原创 2018-07-12 17:04:25 · 287 阅读 · 0 评论