
ACM-ICPC
大弱智鱼
这个作者很懒,什么都没留下…
展开
-
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 · 253 阅读 · 0 评论 -
进制转换-python的EOF
https://www.nowcoder.com/practice/0337e32b1e5543a19fa380e36d9343d7?tpId=60&tqId=29473&tPage=1&ru=/kaoyan/retest/1001&qru=/ta/tsing-kaoyan/question-ranking try: while True: ...原创 2020-04-13 23:15:49 · 276 阅读 · 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 · 150 阅读 · 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 · 188 阅读 · 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 · 167 阅读 · 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 · 275 阅读 · 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 · 108 阅读 · 0 评论 -
另类排序方法
题目描述 给你n个整数,请按从大到小的顺序输出其中前m大的数。 输入 每组测试数据有两行,第一行有两个数n,m(0<n,m<1000000)n,m(0<n,m<1000000)n,m(0<n,m<1000000),第二行包括含有nnn个各不相同,且都处于区间[−50000,50000][-50000,50000][−50000,50000]的整数。 输出...原创 2020-02-24 16:05:43 · 330 阅读 · 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 · 195 阅读 · 0 评论 -
My Friend of Misery Gym - 101086A——思维题
原题链接:https://codeforces.com/gym/101086/problem/A With 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 · 251 阅读 · 0 评论 -
Chance Gym - 101086L——二进制,素数
原题链接:https://codeforces.com/gym/1010 After 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 · 870 阅读 · 0 评论 -
Flip the Bits Gym - 101810C——二进制处理
原题链接:https://codeforces.com/gym/101810/problem/C You 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 · 300 阅读 · 0 评论 -
Friends and Cookies Gym - 101810B ——数学,找规律
原题链接:https://codeforces.com/gym/101810/problem/B Abood'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 · 195 阅读 · 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 · 294 阅读 · 0 评论 -
Gym - 100814A Arcade Game——数论、全排列
这道题很容易卡时间,最后求概率要用递推法求,暴力求会超时 #include<bits/stdc++.h> using namespace std; typedef long long ll; #define inf 0x3f3f3f3f const ll N = 1e3; ll fac[N]; int a[15]; double ans[N]; bool cmp(char a,...原创 2019-04-28 21:55:42 · 301 阅读 · 0 评论 -
ACM学习笔记
数论 例题100814A Arcade Game可以用到康托展开,康托展开也就是用来求一个数在这个数的全排列中是第几大的数。原创 2019-04-28 21:37:41 · 258 阅读 · 0 评论 -
Red and Black
题目描述 有一个长方形的房间,铺着方形瓷砖。每块瓷砖都涂上红色或黑色。一个男人站在黑色的瓷砖上。从瓦片,他可以移动到四个相邻的瓷砖之一。但他不能在红瓦上移动,他只能在黑瓦上移动。 编写一个程序,通过重复上述步骤来计算他可以达到的黑色瓷砖的数量。 输入 输入由多个数据集组成。数据集以包含两个正整数W和H的行开始; W和H分别是x方向和y方向上的瓦片数量。W和H不超过20. 数据集中有更多的行,每个行...原创 2019-04-22 22:10:54 · 199 阅读 · 0 评论 -
Surf
Problem S — limit 4 seconds Surf Now that you’ve come to Florida and taken up surfing, you love it! Of course, you’ve realized that if you take a particular wave, even if it’s very fun, you may miss a...原创 2019-04-22 20:38:44 · 233 阅读 · 0 评论 -
codeforces631B
B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Kris works in a large company “Blake Technologies”. As a best engineer of th...原创 2019-04-25 21:17:27 · 128 阅读 · 0 评论