04 2024 档案

摘要:#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long struct Fraction{ ll fenzi,fenmu; }; int gcd(int a,int b 阅读全文
posted @ 2024-04-20 11:43 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:好累。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long int parent[10010],exist[10010]; struct node{ int rs 阅读全文
posted @ 2024-04-20 04:49 YuKiCheng 阅读(5) 评论(0) 推荐(0) 编辑
摘要:注意判断条件那个pr,pl位置不要写反了。我两次都写错了。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long const int N = 40; int L[N 阅读全文
posted @ 2024-04-20 03:58 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:记得初始化,初始化,初始化!!! #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long int dist[510]; int edges[510][510]; bo 阅读全文
posted @ 2024-04-20 03:31 YuKiCheng 阅读(8) 评论(0) 推荐(0) 编辑
摘要:这题我比较直观的思路就是将分母和K计算出来公倍数,统一分母,然后分子从小到大依次枚举。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long int gcd(int 阅读全文
posted @ 2024-04-20 00:23 YuKiCheng 阅读(7) 评论(0) 推荐(0) 编辑
摘要:字符串处理我的噩梦。 看dalao才写出来的,不过写的太久了,这个时长考试黄花菜都凉了。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long string ans 阅读全文
posted @ 2024-04-19 21:43 YuKiCheng 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long string cs; int main(){ getline(cin,cs); int res = 0; fo 阅读全文
posted @ 2024-04-19 20:03 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long int main() { int n,d; double e;//阈值 int ke=0,kong=0;//数 阅读全文
posted @ 2024-04-18 19:13 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:测试点1,可能给出的数字<=0,也是不合法的。 Dev-C好像不能打印出来╮这个字符,搞得我一直以为写错了,实际上并没有错。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll lo 阅读全文
posted @ 2024-04-18 17:28 YuKiCheng 阅读(13) 评论(0) 推荐(0) 编辑
摘要:记录一下问题。 v1(13分) #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long int main(){ double r1,p1,r2,p2; cin>>r1 阅读全文
posted @ 2024-04-18 16:17 YuKiCheng 阅读(7) 评论(0) 推荐(0) 编辑
摘要:和力扣上一道题差不多,不过的当时没写出来,这次出来了。 注释写好了。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long int arr[100010]; int 阅读全文
posted @ 2024-04-18 15:34 YuKiCheng 阅读(7) 评论(0) 推荐(0) 编辑
摘要:暴力(15分) #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long double a[100010]; int main(){ int n; cin>>n; fo 阅读全文
posted @ 2024-04-18 14:53 YuKiCheng 阅读(3) 评论(0) 推荐(0) 编辑
摘要:暴力(12分) #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long int a[100010]; int main(){ int n; cin>>n; for(i 阅读全文
posted @ 2024-04-18 12:37 YuKiCheng 阅读(26) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; #define ll long long char a[110],b[110]; int cal[110],cal2[110]; char cal3[1 阅读全文
posted @ 2024-04-18 11:58 YuKiCheng 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> const int inf = 0x3f3f3f3f; #define ll long long using namespace std; int res1,res2; int main(){ int n; cin>>n; for(int i=0;i 阅读全文
posted @ 2024-04-18 11:01 YuKiCheng 阅读(6) 评论(0) 推荐(0) 编辑
摘要:最最严重的问题, 如果字符串只有一个的时候不一定就是个位,也可能是十位,这要取决于在哪个数组中出现。 还有如果是数字,比如13,那么十位是1,个位是0没问题吧,按照平时应该输出tam tret,但是这题的要求是只输出tam即可。 所以也要在代码里面特判。 我真的想吐槽C++字符串处理,java明明一 阅读全文
posted @ 2024-04-18 10:10 YuKiCheng 阅读(7) 评论(0) 推荐(0) 编辑
摘要:只要有一个珠子缺少,那么就是缺少珠子,我们需要将缺少的珠子(mp[x]<0的)加起来。 #include <bits/stdc++.h> using namespace std; char cs[1100],cs2[1100]; map<char,int> mp; int main(){ cin>> 阅读全文
posted @ 2024-04-17 20:35 YuKiCheng 阅读(6) 评论(0) 推荐(0) 编辑
摘要:把单位统一了做减法。 #include <bits/stdc++.h> using namespace std; int c1,c2,c3; int a1,a2,a3; int main(){ scanf("%d.%d.%d",&c1,&c2,&c3);//应该支付 scanf("%d.%d.%d" 阅读全文
posted @ 2024-04-17 20:06 YuKiCheng 阅读(8) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int n; int a[110],c[110]; int main(){ cin>>n; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++) cin>> 阅读全文
posted @ 2024-04-17 18:52 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:没做出来,看dalao的,dalao超巨。 注意的点: 分子0的处理/计算公约数的时候取正不然会改变正负性 reduction为核心方法 #include <bits/stdc++.h> using namespace std; #define ll long long struct Fractio 阅读全文
posted @ 2024-04-17 17:04 YuKiCheng 阅读(7) 评论(0) 推荐(0) 编辑
摘要:如果是小写字母,需要转化为大写,然后判断bad里面有没有。 如果是大写字母,需要判断bad里面有没有以及上档键是不是坏了。 如果是其他,判断bad里面有没有。 #include <bits/stdc++.h> using namespace std; #define ll long long int 阅读全文
posted @ 2024-04-17 15:15 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:直观:(25分) #include <bits/stdc++.h> using namespace std; #define ll long long vector<ll> vec; map<ll,int> mp;//元素-所在下标 int main(){ int n; ll p; cin>>n>> 阅读全文
posted @ 2024-04-17 11:00 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ char s1[100],s2[100]; cin>>s1>>s2; //按照次序来 vector<char> vec; int j = 0; for(int i=0;i<strlen 阅读全文
posted @ 2024-04-17 10:09 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:贴贴贴。 没技巧: #include <bits/stdc++.h> using namespace std; struct node { int year; int month; int day; string name; } s[100010]; bool cmp(node n1,node n2 阅读全文
posted @ 2024-04-16 21:37 YuKiCheng 阅读(4) 评论(0) 推荐(0) 编辑
摘要:我看其他博客用的reverse,但是下标我真的有点糊涂,以下是参考某位dalao的。 #include <bits/stdc++.h> using namespace std; struct node { int sno; int data; int next; } s[100010]; int m 阅读全文
posted @ 2024-04-16 13:29 YuKiCheng 阅读(9) 评论(0) 推荐(0) 编辑
摘要:字符串处理,费劲。 #include <bits/stdc++.h> using namespace std; int main() { string s; cin>>s; //找到E的位置 int index = s.find('E'); //分割开 string s1 = s.substr(1, 阅读全文
posted @ 2024-04-16 11:21 YuKiCheng 阅读(8) 评论(0) 推荐(0) 编辑
摘要:呃,直接看代码吧。 #include <bits/stdc++.h> using namespace std; int main() { int a[10]; int mc = -1; for(int i=0; i<10; i++) { int count; cin>>count; if(mc == 阅读全文
posted @ 2024-04-15 20:30 YuKiCheng 阅读(3) 评论(0) 推荐(0) 编辑
摘要:给定的范围是2^30-1,如果是转化成2进制,也得30位,所以 不管用int或者long long都是没办法接收的(int大概是9位,long long是19位)只能用数组/栈了。 #include <bits/stdc++.h> using namespace std; #define ll lo 阅读全文
posted @ 2024-04-15 20:10 YuKiCheng 阅读(20) 评论(0) 推荐(0) 编辑
摘要:第一次知道sprintf这个函数,孤陋寡闻了。 写法一, #include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; char cs[100]; sprintf(cs,"%04d",n); int a = 0,b= 阅读全文
posted @ 2024-04-15 18:41 YuKiCheng 阅读(9) 评论(0) 推荐(0) 编辑
摘要:又臭又长。 #include <bits/stdc++.h> using namespace std; map<int,char> mp = {{1,'C'},{2,'J'},{3,'B'}}; int wa[10],wb[10],ping;//a通过各种手势赢得比赛的次数 假定依次是cjb int 阅读全文
posted @ 2024-04-15 17:21 YuKiCheng 阅读(3) 评论(0) 推荐(0) 编辑
摘要:方法: 逐位试商法。 测试点2: 被除数小于除数 #include <bits/stdc++.h> using namespace std; int main(){ string s; int b; cin>>s>>b; int a[1010],c[1010]; for(int i=0;i<s.si 阅读全文
posted @ 2024-04-15 16:08 YuKiCheng 阅读(5) 评论(0) 推荐(0) 编辑
摘要:又臭又长 #include <bits/stdc++.h> using namespace std; struct node { string sno; int df; int cf; } s[10010]; vector<node> a,b,c,d;//三个批 bool cmp(node x1,n 阅读全文
posted @ 2024-04-15 15:11 YuKiCheng 阅读(3) 评论(0) 推荐(0) 编辑
摘要:我感觉是这题出的有问题,第二个只说了字母,并没有说第二个大写字母...为啥就得从第一个大写字母后面开始检索呢。 #include <bits/stdc++.h> using namespace std; map<int,string> mp = {{1,"MON"},{2,"TUE"},{3,"WE 阅读全文
posted @ 2024-04-14 23:00 YuKiCheng 阅读(3) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; bool isPrime(int x){ if(x==1) return false; for(int i=2;i<=sqrt(x);i++){ if(x%i==0) return false; } retu 阅读全文
posted @ 2024-04-14 20:59 YuKiCheng 阅读(5) 评论(0) 推荐(0) 编辑
摘要:测试点2应该是只输入1对并且是一个常数,如3 0这种。应该输出0 0。 #include <bits/stdc++.h> using namespace std; vector<int> a,b;//系数 指数 int main(){ int xs,zs; while(cin>>xs>>zs){ a 阅读全文
posted @ 2024-04-13 15:47 YuKiCheng 阅读(6) 评论(0) 推荐(0) 编辑
摘要:#include <bits/stdc++.h> using namespace std; int main(){ string s; getline(cin,s); string str = ""; vector<string> vec; for(int i=0;i<s.size();i++){ 阅读全文
posted @ 2024-04-12 20:38 YuKiCheng 阅读(9) 评论(0) 推荐(0) 编辑
摘要:代码有点长,但是我比较喜欢这种做法。 注意的点是如果第一个参与了反转,那么返回的就是区间反转之后的头结点,而不是原始头结点。 import java.util.*; /* * public class ListNode { * int val; * ListNode next = null; * p 阅读全文
posted @ 2024-04-12 12:46 YuKiCheng 阅读(5) 评论(0) 推荐(0) 编辑
摘要:开始刷数据结构了。 1.递归 import java.util.*; /* * public class ListNode { * int val; * ListNode next = null; * public ListNode(int val) { * this.val = val; * } 阅读全文
posted @ 2024-04-12 11:52 YuKiCheng 阅读(5) 评论(0) 推荐(0) 编辑
摘要:dijkstra+判断。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int edges[210][210],visited[210]; int cnt[210],enemy[210],pre[2 阅读全文
posted @ 2024-04-10 19:51 YuKiCheng 阅读(14) 评论(0) 推荐(0) 编辑
摘要:这题思路不难,但是真的真的不太好写。 #include <bits/stdc++.h> using namespace std; const int maxn = 10000; const int inf = 0x3f3f3f3f; vector<int> vec[maxn]; int line[m 阅读全文
posted @ 2024-04-10 19:47 YuKiCheng 阅读(23) 评论(0) 推荐(0) 编辑
摘要:DFS。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; vector<vector<int>> vec; int vis[10003]; int main() { int n,m,k; cin>>n 阅读全文
posted @ 2024-04-07 20:31 YuKiCheng 阅读(12) 评论(0) 推荐(0) 编辑
摘要:拿起题就开始写,最后提交测试点2和测试点3就是过不去。 感觉一点问题都没有,好郁闷,找了半天,发现地点的编号是0开始的,而我一直在从1遍历.... 思路就是两个dijkstra,这两次思路是完全一样的,只是一个是最短距离最少节点,一个是最短时间最短距离,所以分别需要增加一个累计经过节点数量和累计节点 阅读全文
posted @ 2024-04-03 17:44 YuKiCheng 阅读(14) 评论(0) 推荐(0) 编辑
摘要:dijkstra。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int distances[1010][1010]; int dis[1020],visited[1020]; int edges[ 阅读全文
posted @ 2024-04-03 12:16 YuKiCheng 阅读(13) 评论(0) 推荐(0) 编辑
摘要:首先,这是一个三维空间上的,题目的意思就是给了五个3*4的切片,从下往上叠在一起,对于一个像素点来说,他的前后左右上下这六个方向都是他的连通像素点。 代码: #include <bits/stdc++.h> using namespace std; int a[65][130][1300]; int 阅读全文
posted @ 2024-04-03 10:41 YuKiCheng 阅读(10) 评论(0) 推荐(0) 编辑
摘要:并查集的应用,我感觉这题不是很容易想出来。然后....代码看注释吧。 写法一, #include <bits/stdc++.h> using namespace std; int a[1010][1010],fa[1010]; int getf(int x){ while(fa[x]!=-1){ x 阅读全文
posted @ 2024-04-03 08:54 YuKiCheng 阅读(12) 评论(0) 推荐(0) 编辑
摘要:维护两个栈。一个正常放数据,另一个是排序好的数据。 #include <bits/stdc++.h> using namespace std; int main(){ vector<int> data; vector<int> mdata; vector<int>::iterator it; int 阅读全文
posted @ 2024-04-02 20:01 YuKiCheng 阅读(17) 评论(0) 推荐(0) 编辑
摘要:一道很简单的DFS。 #include <bits/stdc++.h> using namespace std; int n,m,a[10010]; vector<int> res; void dfs(int start,int own){ for(int i=start;i<n;i++){ if( 阅读全文
posted @ 2024-04-02 19:24 YuKiCheng 阅读(11) 评论(0) 推荐(0) 编辑
摘要:int类型最多表示的21亿,这个题int就可以。 #include <bits/stdc++.h> using namespace std; int getSum(int a){ int res = 0; while(a){ res += a%10; a/=10; } return res; } i 阅读全文
posted @ 2024-04-02 10:18 YuKiCheng 阅读(37) 评论(0) 推荐(0) 编辑
摘要:暴力枚举。 #include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int res1,res2; int main(){ int a,b,c;//女生 男生 寝室数 cin>>a>>b>>c; int min 阅读全文
posted @ 2024-04-02 10:02 YuKiCheng 阅读(73) 评论(0) 推荐(0) 编辑
摘要:这个题目是stl的使用和字符串拼接。 java里头substring是从首部到尾部的位置,但是C++里面substr是首部位置,和要截取的长度。 我算这种经常出错,每次都搞得很晕。 #include <bits/stdc++.h> using namespace std; string cs; in 阅读全文
posted @ 2024-04-02 08:52 YuKiCheng 阅读(62) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示