
C++
大弱智鱼
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++大数模板
#include<iostream>#include<string>#include<algorithm>using namespace std;//大数加法string addString(string a,string b){ int carry=0; string res; int i=a.size()-1; int j=b.size()-1; while(i>=0 && j>=0)原创 2020-06-23 21:37:17 · 267 阅读 · 0 评论 -
背包优化-动态规划
原题链接:https://www.nowcoder.com/practice/d7c03b114f0541dd8e32ce9987326c16?tpId=40&tqId=21406&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking#include<cstdio>#inc...原创 2020-04-04 12:58:31 · 159 阅读 · 0 评论 -
最短路径问题-迪杰斯特拉
原题链接:https://www.nowcoder.com/practice/e372b623d0874ce2915c663d881a3ff2?tpId=40&tqId=21483&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking#include<cstdio>#inc...原创 2020-04-01 22:01:34 · 202 阅读 · 0 评论 -
Kruskal-还是通畅工程
原题链接:https://www.nowcoder.com/practice/d6bd75dbb36e410995f8673a6a2e2229?tpId=40&tqId=21479&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking#include<cstdio>#incl...原创 2020-04-01 00:35:38 · 183 阅读 · 0 评论 -
质因数的个数-素因数分解
原题链接:https://www.nowcoder.com/practice/20426b85f7fc4ba8b0844cc04807fbd9?tpId=40&tqId=21338&tPage=1&rp=1&ru=/ta/kaoyan&qru=/ta/kaoyan/question-ranking#include<cstdio>#incl...原创 2020-03-25 17:57:38 · 288 阅读 · 0 评论 -
C++字符串与数值类型的转换
std::string str;int i = atoi(str.c_str());原创 2020-03-04 22:12:13 · 183 阅读 · 0 评论 -
leetcode-3. 无重复字符的最长子串-滑动窗口
原题链接:https://leetcode-cn.com/problems/longest-substring-without-repeating-characters##3 给定一个字符串,请你找出其中不含有重复字符的 最长子串 的长度。示例 1:输入: “abcabcbb”输出: 3解释: 因为无重复字符的最长子串是 “abc”,所以其长度为 3。示例 2:输入: ...原创 2020-03-01 23:05:39 · 121 阅读 · 0 评论 -
Leaving the Bar -CF996E - 概率
附上原题链接:https://codeforces.com/contest/996/problem/E这题的解法真的很玄学,简单来说就是对这个数组进行一种操作,如果该操作的结果不能满足条件,就对该数组进行随机排列,再进行这种操作,重复上述过程,知道满足条件。#include<bits/stdc++.h>#include<iostream>#include...原创 2019-07-09 18:07:14 · 206 阅读 · 0 评论 -
用C++实现四阶Runge-Kutta法求解微分方程组
比较简单,照着公式算就可以了。#include<bits/stdc++.h>using namespace std;#define inf 0x3f3f3f3f#define eps 1e-6typedef long long ll;const ll N = 1e3;double x[N];double y[N];double f(double x, dou...原创 2019-05-29 22:28:09 · 5751 阅读 · 3 评论 -
C++实现牛顿迭代法求解非线性方程
#include<bits/stdc++.h>#define e 2.718281828489#define eps 0.5*1e-5#define eps2 1e-12#define inf 0x3f3f3f3fusing namespace std;typedef long long ll;const ll N = 1e5;double f1(double x)...原创 2019-05-19 14:09:34 · 3373 阅读 · 0 评论 -
一般离散无记忆信道容量的逐步迭代算法—C++实现
参考教材:《信息论(第四版)——基础理论与应用》教材给的算法描述让我怀疑作者有没有亲自编程尝试过。注意到 x^(lny) = y.#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll N = 1e3;const double eps = 1e-6;double p[N...原创 2019-05-05 21:50:27 · 1951 阅读 · 1 评论 -
My Friend of Misery Gym - 101086A——思维题
原题链接:https://codeforces.com/gym/101086/problem/AWith the SCPC2015 getting closer, Noura Boubou, SCPC Head of Media, was very busy to the extent of not having time to recharge her phone's credit bala...原创 2019-05-04 23:08:24 · 265 阅读 · 0 评论 -
Chance Gym - 101086L——二进制,素数
原题链接:https://codeforces.com/gym/1010After Noura's brother, Tamim, finished his junior training, coach Fegla was impressed with his progress. He told Noura that if Tamim would solve the following pro...原创 2019-05-04 23:01:49 · 893 阅读 · 0 评论 -
Flip the Bits Gym - 101810C——二进制处理
原题链接:https://codeforces.com/gym/101810/problem/CYou are given a positive integern. Your task is to build a numbermby flipping the minimum number of bits in the binary representation ofnsuch tha...原创 2019-05-04 22:47:20 · 323 阅读 · 0 评论 -
Friends and Cookies Gym - 101810B ——数学,找规律
原题链接:https://codeforces.com/gym/101810/problem/BAbood's birthday has come, and hisnfriends are aligned in a single line from1ton, waiting for their cookies, Abood hasxcookies to give to his f...原创 2019-05-04 22:39:00 · 206 阅读 · 0 评论 -
N-Dimensional Grid Gym - 101810E——多维空间,取余运算的处理。
原题链接:https://vjudge.net/problem/1610119/origin解决思路:答案是(a1-1)*a2*a3*...*an + a1*(a2-1)*a3*a4*...*an+a1*a2*(a3-1)*a4*...*an+.....+a1*a2*a3*...*(an-1)在处理的时候,可以开数组分别记录a1*a2*...(ai-1),再开了数组j记录a[i]*a[...原创 2019-05-04 22:26:32 · 308 阅读 · 0 评论 -
Gym - 100814A Arcade Game——数论、全排列
这道题很容易卡时间,最后求概率要用递推法求,暴力求会超时#include<bits/stdc++.h>using namespace std;typedef long long ll;#define inf 0x3f3f3f3fconst ll N = 1e3;ll fac[N];int a[15];double ans[N];bool cmp(char a,...原创 2019-04-28 21:55:42 · 312 阅读 · 0 评论 -
用C++实现复合求积分公式——复合梯形公式和复合Simpson公式
#include<bits/stdc++.h>using namespace std;typedef long long ll;const ll N = 1e3;double f1(double x){ double ans = 1.0 / (1.0+ sin(x) * sin(x) ); return ans;}double f2(double x){ re...原创 2019-04-28 17:05:33 · 4970 阅读 · 2 评论 -
codeforces631B
B. Print Checktime limit per test 1 secondmemory limit per test 256 megabytesinput standard inputoutput standard outputKris works in a large company “Blake Technologies”. As a best engineer of th...原创 2019-04-25 21:17:27 · 135 阅读 · 0 评论