自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(52)
  • 收藏
  • 关注

原创 CUDA和cuDNN安装配置

CUDA(Compute Unified Device Architecture),是显卡厂商NVIDIA推出的运算平台。CUDA™是一种由NVIDIA推出的通用并行计算架构,该架构使GPU能够解决复杂的计算问题。

2022-11-15 15:43:41 5474 1

原创 卷积神经网络实践-猫狗分类

近年来,深度学习理论和技术都得到了迅速的发展,并且受到了越来越多的研究者的关注,深度学习技术在图像识别领域具有广泛的应用。

2022-10-25 20:05:34 3779 3

原创 共享自行车需求预测学习记录

共享自行车需求预测

2022-08-18 11:11:58 685

原创 L1-019 谁先倒

PTA | 程序设计类实验辅助教学平台两种方法差不多#include <iostream>using namespace std;int main() { int A, B, N, a1, a2, b1, b2; cin >> A >> B >> N; //甲乙酒量 int a = A, b = B; //a和b用来记录A与B何时倒 while (N--) { cin >> a1 >> a2 >>

2022-04-21 21:04:37 164

原创 L1-043 阅览室

PTA | 程序设计类实验辅助教学平台#include <iostream>using namespace std;struct node { int startTime; int st;//0表示未被借出,1表示被借出。} book[1001];int getTime(int hour, int minute) { return hour * 60 + minute;}int main() { int id, hour, minute, days; char.

2022-04-21 19:58:49 348

原创 L1-059 敲笨钟

PTA | 程序设计类实验辅助教学平台一开始我不明白,怎么把一句话分割输入,并且判断下面是先输入在判断,如果逗号前面时候ong并且.前面也是ong那就是押韵的并且根据空格判断第几个单词#include <iostream>using namespace std;typedef long long ll;const int maxn = 1e5 + 10;string s;int main() { int n; cin >> n; getcha..

2022-04-21 17:17:20 319

原创 L1-025 正整数A+B

PTA | 程序设计类实验辅助教学平台按模块写,就不容易写错了#include <iostream>using namespace std;int n1, n2;bool f1 = true, f2 = true, f3 = true, f4 = true;int main() { string a, b; cin >> a; getchar(); getline(cin, b); //b中可能包含空格,所以用getline进行输入 for (int .

2022-04-21 16:46:59 194

原创 L1-020 帅到没朋友

#include <iostream>using namespace std;int a[100000];int main() { int n; cin >> n; int x, id; while(n--) { cin >> x; if (x >= 2) { while(x--) { cin >> id; a[id] = 1; } } else cin >> id; }...

2022-04-21 16:29:07 102

原创 L1-009 N个数求和

PTA | 程序设计类实验辅助教学平台#include <iostream>using namespace std;int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b);}int a[105] , b[105];int main() { int n, i = 0; scanf("%d", &n); scanf("%d/%d", &a[i], &b[i]); int .

2022-04-19 20:49:24 133

原创 L1-002 打印沙漏

PTA | 程序设计类实验辅助教学平台模拟题老是模拟不出来#include <iostream>using namespace std;int main() { int n; char c; cin >> n >> c; int m, i, sum; if (n == 1) cout << c << endl << 0 << endl; else if (n > 1 || n <=

2022-04-18 20:42:46 194

原创 L1-046 整除光棍

开long long循环解题,只拿了15分再次读题,题目的答案是光棍数 / x = s我们思考下除法的本质,是不是会发现答案的每一位都是每除一次的商然后剩下的余数*10加上后面一位,也就是说除法实际上只和两位数有关前面被算过了就可以不考虑了,而光棍数我们知道全是1所以后面我们只要补1就行,这样用int就能存下那这样我们先找到比x大的第一个光棍数,然后每次除以x输出商,再把剩下的余数*10+1,不断循环直到余数为0,表示整除完了定义第一个数为1,循环找到比x大且最小的光棍数之后每除一次

2022-04-18 20:23:51 180

原创 L1-027 出租

PTA | 程序设计类实验辅助教学平台首先是暴力的解法#include <iostream>#include <vector>using namespace std;vector<int> arr;vector<int> index;int tag[12];int main() { string str; cin >> str; for (int i = 0; i < str.size(); i++) ta

2022-04-18 19:52:31 153

原创 L1-034 点赞

PTA | 程序设计类实验辅助教学平台#include <iostream>#include <algorithm>using namespace std;struct node { int b, c;} a[1010];int main() { int n, m, t, k = -10, flag = -10; cin >> n; while (n--) { cin >> m; for (int i = 0; i &l.

2022-04-17 21:19:48 270

原创 L1-078 吉老师的回归

PTA | 程序设计类实验辅助教学平台简单题,有一个点一直不过#include <iostream>using namespace std;int main() { int n, k; string s; cin >> n >> k; getchar(); while (n--) { getline(cin, s); if (s.find("qiandao") != -1 || s.find("easy") != -1) con.

2022-04-17 20:29:07 247

原创 L1-039 古风排版

PTA | 程序设计类实验辅助教学平台两种方法,第一是先把字符串变成字符数组,第二是把字符串直接输出#include <iostream>#include <cstring>using namespace std;int main() { int n; string s; cin >> n; getchar(); getline(cin, s); char str[2010][2010]; memset(str, ' ', sizeof .

2022-04-17 19:54:04 160

原创 L1-080 乘法口诀数列

PTA | 程序设计类实验辅助教学平台需要在引入一个下标j,要不然就会错乱添加位置的下标是i,想乘位置的下标是j另外N尽量开大,至少要大于1534,要不然会出错#include <iostream>using namespace std;const int N = 2010;int a[N];int a1, a2, n;int main() { cin >> a[1] >> a[2] >> n; int j = 3; for

2022-04-16 21:04:46 233

原创 L1-011 A-B

PTA | 程序设计类实验辅助教学平台while里面相当于把a里面与b相等的全删除#include <bits/stdc++.h>using namespace std;typedef long long ll;ll pos;string a, b;int main() { getline(cin, a), getline(cin, b); for (ll i = 0; b[i] != '\0'; i++) while ((pos = a.find(b[...

2022-04-14 21:40:39 196

原创 L1-069 胎压监测

PTA | 程序设计类实验辅助教学平台记录一下,这道题看网上写的非常简洁#include <iostream>#include <algorithm>using namespace std;int main() { int m[6], cnt = 0, flag; for (int i = 0; i < 6; i++) cin >> m[i]; int maxx = max(max(max(m[0], m[1]), m[2]), m[3

2022-04-12 20:01:02 334

原创 L1-050 倒数第N个字符串

PTA | 程序设计类实验辅助教学平台两种方法其实都差不多这个方法用了一些stl#include <bits/stdc++.h>using namespace std;int l, n, sum;string s;int main() { cin >> l >> n; sum = 1; for (int i = 0; i < l; i++) sum *= 26; n = sum - n + 1; ///讲倒数的第几位.

2022-04-12 19:32:42 191

原创 L1-018 大笨钟

本题不难,但是有一个点老是过不了,tnnd#include <iostream>using namespace std;int main() { int a, b; scanf("%d:%d", &a, &b); if (a < 12 || (a == 12 && b == 0)) printf("Only %02d:%02d. Too early to Dang.", a, b); else { a -= 12; for

2022-04-11 20:57:03 96

原创 L1-058 6翻了

PTA | 程序设计类实验辅助教学平台本题比较简单,唯一要注意的是i要<=s.size,不这样的话如果最后一个是666就输出不出来#include <iostream>using namespace std;int cnt = 0;string s;int main() { getline(cin, s); for (int i = 0; i <= s.size(); i++) { if (s[i] == '6') cnt++; else {.

2022-04-11 20:30:24 103

原创 L1-054 福到了

PTA | 程序设计类实验辅助教学平台字符串问题看来还是有很多缺陷,老是写不对这道题先判断对角线是否相等,相等的话进行输出要求的字符#include <iostream>using namespace std;char c;int n, flag = 1;string str[200];int main() { cin >> c >> n; getchar(); for (int i = 0; i < n; i++) getlin

2022-04-11 19:44:06 102

原创 L1-048 矩阵A乘以B

PTA | 程序设计类实验辅助教学平台线性代数的矩阵相乘,当时想用一个数组储存,这反而复杂了直接输出,相乘的时候#include <iostream>using namespace std;int a[110][110], b[110][110];int m, n, x, y;int main() { cin >> m >> n; for (int i = 0; i < m; i++) for (int j = 0; j < .

2022-04-11 18:55:00 178

原创 L1-030 一帮一

PTA | 程序设计类实验辅助教学平台这道题按理说不难,但是没写对,当时越写越复杂这道题本质就是先区分男女,在看按先后输出#include <iostream>#include <map>using namespace std;int n,a[100],p = 0, q = 0,h1=0,h2=0;string s1[100];string s2[100];int main() { cin >> n; for (int i = 0; i

2022-04-10 17:06:06 85

原创 L1-033 出生年

PTA | 程序设计类实验辅助教学平台本题涉及到字符串和数字的切换,我在网上看到很多优雅的解法,大家可以进行参考首先用set函数储存#include<iostream>#include<set>using namespace std;int main(){ int y,n; cin>>y>>n; for(int i=y;i<=3012;i++) { set<int> s;

2022-04-10 16:54:27 73

原创 ​用scanf、printf输入输出string型字符串 ​

c语言里是没有string型的,string在c++里面。有的时候在c++里要用scanf、printf输入输出string型字符串,这是可以实现的,不过要做一点处理。具体操作看代码:#include<cstdio>#include<string>using namespace std;int main(){ int n; string str1; scanf("%d",&n); str1.resize(n); //给字符串

2022-02-13 14:15:48 3143

原创 STL笔记

vector(变长数组),倍增的思想,支持比较运算(按字典序)倍增思想系统为某一程序去分配空间所需要的时间与空间大小无关,与申请的次数、频率有关:一次申请1000个空间的时间开销<申请1000次一个空间的时间开销vector每次空间不够时,都是先开辟当前空间的两倍大小,再把当前的数据复制过来所以在使用vector时,尽量减少申请空间的次数,可以适当的浪费空间,一次开辟较大的空间,以减少后面再频繁申请空间,减少时间开销。初始化 vector <int> a; ...

2022-02-12 17:28:23 100

原创 char,short ,int ,long,long long,unsigned long long数据范围

char -2^7 ~ 2^7-1 (1 Byte)short -2^15 ~ 2^15-1 (2 Bytes)unsigned short 0 ~ 2^16-1 (2 Bytes)int -2^31 ~ 2^31-1 (4 Bytes)unsigned int ...

2022-01-23 14:40:57 304

原创 Happy New Year B. Mirror in the String

Example Input410codeforces9cbacbacba3aaa4bbaaOutputcccbaabcaabb你有一字符串s,你站在字符串的左边,向右看。您想选择一个索引k (1≤K≤n) 在第k个字母后面放一面镜子,这样你看到的是s1s2…sksk−1…s1 .找出能看到的最小词典字符串对于每个测试用例,打印您所能看到的按字典顺序排列的最小字符串。一个没用的小知识如果使用 #define int long long 时不能使用

2022-01-06 15:52:33 693

原创 Happy New Year A - Integer Diversity

Example Input341 1 2 231 2 320 0Output431第一行是t个样例,第二行是n个数字,可以选择给定数字的任何子集(可能是无或所有数字),并对这些数字求反(即更改x)→(−x) )。数组中可以实现的最大不同值数是多少?例如,在第一个示例中,我们可以对第一个和最后一个数字求反,从而得到数组[−1,1,2,−2] 有四个不同的值。 在第二个例子中,这三个数字已经不同了。 在第三个例子中,否定不会改变任何东西。一开始理解错了,想的是用s

2022-01-03 19:31:51 224

原创 为什么cin,cout比scanf,printf慢

昨天一位同学找我询问这个问题,我大概明白,又不太明白之前只是知其然不知其所以然,所以今天特意总结一下cin、cout之所以效率低,是因为先把要输出的东西存入缓冲区,再输出,导致效率降低,而这段语句可以来打消iostream的输入、输出缓存,可以节省许多时间std::ios::sync_with_stdio(false);cin.tie(0);tie是将两个stream绑定的函数,空参数的话返回当前的输出流指针sync_with_stdio这个函数是一个“是否兼容stdio”的开

2021-11-30 10:19:21 1672

原创 greater<int>()和less<int>()的区别于用法

greater和less是头文件<xfunctional>中定义的两个结构。下面看它们 的定义,greater和less都重载了操作符()。 // TEMPLATE STRUCT greatertemplate<class _Ty> struct greater : public binary_function<_Ty, _Ty, bool> { // functor for operator> bool operator()(const _Ty

2021-11-23 20:40:41 357

原创 求n个数的最小公倍数和最大公约数

#include <iostream>#include <algorithm>using namespace std;int GCD(int x, int y) { int b; if (x < y) //将大的数排在前面 swap(x, y); while (x % y != 0) { //一直循环直到y是x的因数 b = x % y; x = y; // 不断取除数 作为x y = b; //不断取余数 作为y } return y.

2021-11-18 17:21:23 111

原创 Palindromes UVA - 401

#include <stdio.h>#include <string.h>char MirroredStr[] = {'A', ' ', ' ', ' ', '3', ' ', ' ', 'H', 'I', 'L', ' ', 'J', 'M', ' ', 'O', ' ', ' ', ' ', '2', 'T', 'U', 'V', 'W', 'X', 'Y', '5' };char .

2021-11-16 19:12:20 335

原创 UVa10082:WERTYU

WERTYU - UVA 10082 - Virtual Judgehttps://vjudge.net/problem/UVA-10082两种方法,第一种紫皮书上的,第二种网上的,感觉网上的更简单#include <iostream>using namespace std;char s[] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";int main () { int i, c; while ((c = getc

2021-11-15 21:58:21 832

原创 关于字符串的再学习

最近想着再学习一下字符串,总结了一下小小知识点#include <iostream>#include <algorithm>#include <cstring>using namespace std;char a[1001];int main() { gets(a); for (int i = strlen(a) - 1; i >= 0 ; i--) { printf("%c", a[i]); } return 0;}

2021-11-13 09:59:58 303

原创 Alarm Clock CodeForces - 1354A

睡a分钟才可以下床,假设在第0分钟睡着,那么第一个闹铃会在b分钟后响。每次醒来,都会决定是否要再睡一段时间,如果他总共睡的时间小于a分钟,那么他就会设置闹钟在c分钟之后再次响起,然后再花费d分钟重新入睡。如果起不了床了输出-1,否则输出从床上起来需要的时间。如果b>=a可以睡够,就直接输出b这个醒来的时间,如果c<=d则永远不会睡着,输出-1如果(a - b) % (c - d)不能被整除就向上取整,进行+1操作#include <iostream>#includ

2021-11-09 20:01:14 229

原创 Omkar and Infinity Clock CodeForces - 1392B

题意:输入一个n,k和一个a序列,你可以进行操作,计算出a中的最大值d,然后ai=d−ai​,进行k次这样的操作,求出最后的a序列。这道题有规律当k为奇数次时,结果和第一次运算相同,当k为偶数次时,结果和第二次运算相同,#include <iostream>#include <algorithm>using namespace std;typedef long long ll;const int N = 2e5 + 100;ll arr[N];int m

2021-11-09 19:36:29 206

原创 Long Number CodeForces - 1157B

题意:给出一个字符串长度n,再给出一个数字字符串,接下来一行9个数,进行替换注意替换时最好判断一个替换一个,不需要最后存储下来再判断判断时每一个数字进行判断,如果替换之后比原来大,就进行替换,不是的话直接退出,退出的这种情况就是最大的注意while中的是大于等于,例如1111110和1111119就判断不出来#include <iostream>#include <algorithm>using namespace std;const int N =

2021-11-09 18:55:57 88

原创 {A} + {B} HDU - 1412

Description给你两个集合,要求{A} + {B}.注:同一个集合中不会有两个相同的元素.Input每组输入数据分为三行,第一行有两个数字n,m(0<n,m<=10000),分别表示集合A和集合B的元素个数.后两行分别表示集合A和集合B.每个元素为不超出int范围的整数,每个元素之间有一个空格隔开.Output针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出,每个元素之间有一个空格隔开.Sample Input1 212 3

2021-10-24 14:53:11 85

空空如也

空空如也

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

TA关注的人

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