上机题
zcy_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PAT 1053 Path of Equal Weight 两个测试点不知道错哪-知道了!
#include<stdio.h> #include<iostream> #include<math.h> #include<algorithm> #include<string> #include<vector> #include<queue> using namespace std; struct node{ int value; vector<int> child; }tree[11.原创 2021-09-16 16:36:38 · 285 阅读 · 0 评论 -
1093 Count PAT‘s 坑点
测试点3和4考察取模,不能在最后统计完成后再取模,需要每计算一次就取模 ```cpp #include <iostream> #include <vector> #include<algorithm> #include<string> #include<cmath> using namespace std; int main(){ freopen("in.txt","r",stdin); string a; getli原创 2021-09-14 15:58:15 · 135 阅读 · 0 评论 -
机试题技巧
原创 2021-09-10 00:57:56 · 116 阅读 · 0 评论 -
《算法笔记》要点记录
cin、count消耗时间比scanf和printf多得多原创 2021-09-08 00:05:08 · 109 阅读 · 0 评论 -
c++ 常用数据结构
map 插入:insert 当map内元素值为int类型或常量时,默认值为0; 键值对表示:a[i]++;原创 2021-09-02 14:48:33 · 142 阅读 · 0 评论 -
Leetcode 两数相加
Leetcode 两数相加 int n1 = l1 ? l1->val: 0; //可以这样表示 int n2 = l2 ? l2->val: 0; int等于一个指针,如这个指针为空,则int值为0; 若改为: int n1 = l1->val ? l1->val: 0; 会报错。 完整代码如下: class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {原创 2021-08-24 23:05:26 · 282 阅读 · 0 评论 -
PAT甲级1048 Find Coins 关于sort函数
本来是这样的: 然后将cmp函数里a<=b改成a<b,就全部pass了。 #include<iostream> #include <string> #include <algorithm> using namespace std; bool cmp(int a,int b){ return a<b; } int main(){ int n,m; cin>>n>>m; int a[1010]={原创 2021-03-31 00:31:34 · 114 阅读 · 0 评论 -
PAT甲级1075 PAT Judge 测试点2&4 答案错误
这题是排序题,简单,但坑在细节。 题目说“For those who has never submitted any solution that can pass the compiler, or has never submitted any solution, they must NOT be shown on the ranklist.”存在一种情况:用户pass the compiler 但是得分为0,还是得输出。所以**不能根据总得分是否为0判断该不该被输出**。 有些细节的判断条件需..原创 2021-03-25 12:54:15 · 399 阅读 · 0 评论
分享