![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
patB
小耗子001
得到的和得不到的都是收获
展开
-
patB 1065 单身狗(25)
#include <iostream>#include <cstdio>using namespace std;const int maxn=100001;int couple[maxn];bool mark[maxn];int p_person[maxn];int main(){ int N; scanf("%d",&N); for(int i=...原创 2018-05-20 15:43:05 · 124 阅读 · 0 评论 -
patB 1064朋友数(20)
#include <iostream>#include <cstdio>using namespace std;const int maxn=10001;int num[maxn];int e[maxn]={0};int elen=0;////int resoved(int x){//// int sum=0;//// do{//// sum+=x...原创 2018-05-20 15:42:03 · 194 阅读 · 0 评论 -
patB 1063 计算谱半径(20)
#include <iostream>#include <cstdio>#include <math.h>using namespace std;int main(){ int n; scanf("%d",&n); double maxn=0; for(int i=0;i<n;i++){ double a,b;...原创 2018-05-20 15:40:24 · 135 阅读 · 0 评论 -
patb1062 最简分数(20)
#include <iostream>#include <cstdio>using namespace std;int main(){ int x1,y1,x2,y2,down; scanf("%d/%d %d/%d %d",&x1,&y1,&x2,&y2,&down); int minnum=x1*down*y2;...原创 2018-05-20 15:39:16 · 300 阅读 · 0 评论 -
patB1061 判断题(15)
#include <iostream>#include <cstdio>using namespace std;const int maxn=101;int p_value[maxn];int j_p[maxn];int save_s[maxn];int main(){ int N,M; scanf("%d%d",&N,&M); for(i...原创 2018-05-20 15:36:57 · 201 阅读 · 0 评论 -
patB1039 到底买不买
#include <iostream>#include <cstdio>#include <cstring> using namespace std;int hashT[128]={0};int hashb[128]={0};int main(int argc, char** argv) { char str1[20],str2[20]; gets(str1);...原创 2018-04-27 21:22:23 · 154 阅读 · 0 评论 -
patA1085 完美数列 upper_bound()
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int main(int argc, char** argv) { int n,p; scanf("%d%d",&n,&p)...原创 2018-05-11 21:20:26 · 163 阅读 · 0 评论 -
patA1085 完美数列(25)
注意点:int*int 最大值可能达到10^18暴力解决的时间复杂度肯定超时。#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int binarySearch(int i,int n,lo...原创 2018-05-11 20:45:43 · 196 阅读 · 0 评论 -
patB1020 月饼
#include <iostream>#include <cstdio> #include <algorithm>using namespace std;struct mooncake{ double num; double m; double p; //单位重量上价值量最大的; bool operator < (const mooncake &...原创 2018-05-04 21:49:22 · 204 阅读 · 0 评论 -
patA1101/B1045 快速排序(25)
#include <iostream>#include <cstdio>using namespace std;const int maxn=100010;const int INF=0x7fffffff;int S[maxn];int leftmax[maxn];int rightmin[maxn];void init(int n){ int max=0; for(int...原创 2018-05-14 20:31:27 · 165 阅读 · 0 评论 -
patB1049/patA1104 数列的片段和
#include <iostream>#include <cstdio>using namespace std;const int maxn=100010;double S[maxn];int main(int argc, char** argv) { int N; scanf("%d",&N); for(int i=1;i<=N;i++) scanf("%l...原创 2018-05-15 20:33:27 · 299 阅读 · 0 评论 -
patB 1030 完美数列
分析了下,暴力解决这个问题的事件复杂度大概是 10^5 * 10^5 200ms 马马虎虎正好够用,先用快速排序对数组中的数字进行排序,再者只需要遍历数组中数字,把从该位开始到多少结束,中间的数字统计一下,最后遍历一下统计的数组就ok了。#include <iostream>#include <cstdio>#include <cstring>...原创 2019-02-28 21:29:48 · 194 阅读 · 0 评论 -
patB1013 数素数
#include <iostream>#include <cstdio>using namespace std;const int maxn=1000001;int prime[maxn];bool isprime[maxn]={false};int primesize=0;void findprime(){ for(int i=2;i<maxn;i++){ if(...原创 2018-05-24 21:06:12 · 241 阅读 · 0 评论 -
patB 素数对猜想
#include <iostream>#include <stdio.h>bool remark[1000];int prime[1001];int primesize;using namespace std;int main(){ int i,j; for(i=0;i<=1000;i++){ remark[i]=false; } ...原创 2018-05-23 22:22:56 · 141 阅读 · 0 评论 -
patB1070 接绳(25)
#include<bits/stdc++.h> using namespace std; int main() { //优先队列大的优先 priority_queue<double,vector<double>, greater<double> >ss;//改成小的优先 int n; double s,xf;...原创 2018-05-26 17:52:30 · 170 阅读 · 0 评论 -
patB1069 微博转发抽奖(20)
#include <iostream>#include <cstdio> #include <cstring>#include <set>using namespace std;const int maxn=1001;string person[maxn];set<string> SS;int main(int argc, char** ...原创 2018-05-26 17:50:52 · 314 阅读 · 0 评论 -
patB1068 万绿丛中一点红(20)
#include <iostream>#include <cstdio> using namespace std;const int maxn=510;int buf[maxn][maxn];int main(int argc, char** argv) { int m,n,left,right,v; scanf("%d %d %d %d %d",&m,&n...原创 2018-05-26 17:49:51 · 281 阅读 · 1 评论 -
patB1067 试密码 (20)
#include <iostream>#include <cstdio> using namespace std;const int maxn=510;int buf[maxn][maxn];int main(int argc, char** argv) { int m,n,left,right,v; scanf("%d %d %d %d %d",&m,&n...原创 2018-05-26 17:48:49 · 209 阅读 · 0 评论 -
patB 1066 图像过滤(15)
#include <iostream>#include <cstdio> using namespace std;const int maxn=510;int buf[maxn][maxn];int main(int argc, char** argv) { int m,n,left,right,v; scanf("%d %d %d %d %d",&m,&n...原创 2018-05-26 17:47:49 · 228 阅读 · 0 评论 -
patB 1033旧键盘打字(超时)
#include <iostream>#include <cstdio> #include <cstring> using namespace std;int HashT[128]={0};int main(int argc, char** argv) {// printf("%d",'+'); char str1[100005],str2[100005]; g...原创 2018-04-25 21:57:24 · 277 阅读 · 0 评论 -
patB1005 继续3n+1 猜想
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;int hashT[100000]={0};void find(int x){ while(x!=1){ if(x%2==0) { x/=2; hashT[x]=1; } else{ x=3*x...原创 2018-05-03 13:52:39 · 160 阅读 · 0 评论 -
patb1028人口普查
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;struct person{ char name[20]; int yy,mm,dd; bool operator <(const person &e...原创 2018-04-10 20:49:44 · 183 阅读 · 0 评论 -
patb1041 查找考试座位号
#include <iostream>#include <cstdio> using namespace std;struct student{ char id[14]; int machine_id; int seat_id;}a[1001];int try_seat[1001];int main(int argc, char** argv) { int N; scanf...原创 2018-04-10 19:41:40 · 281 阅读 · 0 评论 -
patB1002 写出这个数
#include <iostream>#include <cstring> #include <algorithm>using namespace std;const int maxn=10000001;int buf[maxn];int num[100];int numsize=0;void change(int x){ do{ num[numsize++]...原创 2018-04-15 20:55:53 · 184 阅读 · 0 评论 -
patB1031 查验身份证
#include <iostream>#include <cstring> using namespace std;int weight[17]={7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2};int z[11]={0,1,2,3,4,5,6,7,8,9,10};char m[11]={'1','0','X','9','8','7','6','5...原创 2018-04-15 20:38:53 · 285 阅读 · 0 评论 -
patB1021个位数的统计
#include <iostream>#include <cstring> using namespace std;int hashT[10]={0};int main(int argc, char** argv) { string str; cin>>str; for(string::iterator it=str.begin();it!=str.end();...原创 2018-04-15 20:01:06 · 209 阅读 · 0 评论 -
patB1006 换个格式输出整数
#include <iostream>#include <cstdio> #include <cstring>using namespace std;int main(int argc, char** argv) { string str; cin>>str; string::iterator it=str.begin(); switch(str.s...原创 2018-04-15 19:52:06 · 138 阅读 · 0 评论 -
patb1026 程序的运行时间
c++中当只有一个数字的时候前面需要用setw,和setfill俩个来补充,需要添加头文件<iomanip>#include <iostream>#include <cstdio>#include <iomanip>using namespace std;int ss,mm,hh;void getans(int dis){ ss=dis%60;...原创 2018-04-02 21:16:00 · 123 阅读 · 0 评论 -
patb1016部分a+b
注意到俩者相同的部分,把它整成一个函数,然后需要什么数字就调用这个函数;#include <iostream>#include <cstdio>using namespace std;int compute(int x,int y){ int sum=0; while(x!=0){ if(x%10==y) sum=sum*10+y; ...原创 2018-04-02 20:29:06 · 196 阅读 · 0 评论 -
patb1010多项式的求导
#include <iostream>#include <cstdio> using namespace std;int main(int argc, char** argv) { int num[1001]={0}; int ans[1001]={0}; int m,x; while(scanf("%d%d",&x,&m)!=EOF){ num[m]=x...原创 2018-04-09 21:59:28 · 274 阅读 · 0 评论 -
patA1061 dating
#include <iostream>#include <cstring>#include <cstdio>#include <iomanip>using namespace std;string date[7]={"MON","TUE","WED","THU","FRI","SAT&qu原创 2018-04-16 21:45:04 · 156 阅读 · 0 评论 -
patb1032挖掘机哪家强
#include <iostream>#include <cstdio>using namespace std;int school[1000001]={0};int main(){// cout << "Hello world!" << endl; int k; scanf("%d",&k); for(int i=0原创 2018-04-11 19:36:56 · 253 阅读 · 0 评论 -
patB1030/patA1085 完美数列
#include <iostream>#include <cstdio>#include <algorithm>using namespace std;const int maxn=100001;int num[maxn];int main(int argc, char** argv) { int n,p; scanf("%d%d",&n,&p)...原创 2018-05-09 22:07:29 · 204 阅读 · 0 评论 -
patB1043 输出PATest
注意:字符串长度的确定要放在循环体外。这样会减少运行的时间。#include <iostream>#include <cstdio>#include <cstring> using namespace std;char strT[6]={'P','A','T','e','s','t'};int hashT[6]={0};int main(int argc, ch...原创 2018-05-02 14:11:19 · 203 阅读 · 0 评论 -
patB1042 字符统计
#include <iostream>#include <cstdio>#include <cstring>using namespace std;int hashT[27]={0};int main(int argc, char** argv) { char str[1200]; gets(str); for(int i=0;i<strlen(str);...原创 2018-05-02 00:00:52 · 180 阅读 · 0 评论 -
patB1037 在霍格沃茨找零钱
#include <iostream>#include <cstdio> using namespace std;int changeTok(int x,int y,int z){ int ans=(x*17+y)*29+z; return ans;}int main(int argc, char** argv) { int g1,s1,k1; scanf("%d.%d.%...原创 2018-04-13 22:05:03 · 274 阅读 · 0 评论 -
patB1022D进制的A+B
#include <iostream>#include <cstdio>using namespace std;int buf[50];int bufsize=0;int main(int argc, char** argv) { int a,b; scanf("%d%d",&a,&b); int ans=a+b; int d; scanf("%d",&am...原创 2018-04-13 21:29:24 · 164 阅读 · 0 评论 -
patB1027 打印沙漏⌛
#include <iostream>#include <cstdio>#include <cmath>using namespace std;int main(int argc, char** argv) { int n; char c; scanf("%d %c",&n,&c); int col=sqrt((n+1)/2); int rest...原创 2018-04-12 21:22:21 · 146 阅读 · 0 评论 -
patB1036跟着奥巴马一起学编程
#include <iostream>#include <cstdio>using namespace std;int main(int argc, char** argv) { int n,c; scanf("%d %c",&n,&c); int d;// int d=(n/2*10)%10; if(n%2==1) d=n/2+1; else d=n/2;...原创 2018-04-12 20:38:15 · 177 阅读 · 0 评论 -
patB1048 数字加密
#include <iostream>#include <cstring> #include <algorithm>using namespace std;char map[13]={'0','1','2','3','4','5','6','7','8','9','J','Q','K'};int main(int argc, char** argv) { str...原创 2018-04-17 21:31:07 · 270 阅读 · 0 评论