ACM入队题
咸鱼子摸鱼代码工程
这个作者很懒,什么都没留下…
展开
-
两数之和哈希
class Solution {public: vector<int> twoSum(vector<int>& nums, int target) { unordered_map<int, int> hashtable; for (int i = 0; i < nums.size(); ++i) { auto it = hashtable.find(target - nums[i]);转载 2022-03-24 21:02:29 · 56 阅读 · 0 评论 -
关于斐波那契的思考
#include<iostream>using namespace std;int Fib(int n){ int num1=1; int num2=1; int temp=0; if(n<3) return 1; else{ for(int i=0;i<n-2;i++) { temp=num1+num2; num1=num2; num2=temp; } return temp; }}int main(){ int n;原创 2022-03-23 23:18:32 · 54 阅读 · 0 评论 -
D - On the Benefits of Umbrellas URAL - 1788
题目D - On the Benefits of Umbrellas URAL - 1788A group of school leavers had their graduation party at an aquapark. They had a great time, but when they were leaving the aquapark they were surprised by a suddenly cold weather and a heavy rain, which made原创 2021-05-18 20:47:24 · 63 阅读 · 0 评论 -
H - Hamming Code URAL - 1792
题目Let us consider four disks intersecting as in the figure. Each of the three shapes formed by the intersection of three disks will be called a petal.Write zero or one on each of the disks. Then write on each petal the remainder in the division by two of原创 2021-05-18 20:39:13 · 82 阅读 · 0 评论 -
最大公约数,最小公倍数(区分)
最大公约数100 99 ----13 6 ----34 5 ----1两个数字拆分,相同的最大因数辗转相除法例如,求(319,377):∵ 319÷377=0(余319)∴(319,377)=(377,319);∵ 377÷319=1(余58)∴(377,319)=(319,58);∵ 319÷58=5(余29)∴ (319,58)=(58,29);∵ 58÷29=2(余0)∴ (58,29)= 29;∴ (319,377)=29。int gcd(in原创 2021-05-17 19:42:58 · 306 阅读 · 0 评论 -
C - Turn for MEGA URAL - 1787
题目A traffic light at the turn for the “MEGA” shopping center from the Novomoskovskiy highway works in such a way that k cars are able to take a turn in one minute. At weekends all the residents of the city drive to the mall to take a shopping, which resul原创 2021-05-16 19:15:34 · 87 阅读 · 0 评论 -
Boy or Girl CodeForces - 236A 与 P1125 [NOIP2008 提高组] 笨小猴
Boy or Girl CodeForces - 236ABoy or Girl CodeForces - 236A 题目Those days, many boys use beautiful girls’ photos as avatars in forums. So it is pretty hard to tell the gender of a user at the first glance. Last year, our hero went to a forum and had a nic原创 2021-05-10 21:00:59 · 168 阅读 · 0 评论 -
P5705 【深基2.例7】数字反转
P5705 【深基2.例7】数字反转题目描述输入一个不小于 100100 且小于 10001000,同时包括小数点后一位的一个浮点数,例如 123.4123.4 ,要求把这个数字翻转过来,变成 4.3214.321 并输出。输入格式一行一个浮点数输出格式一行一个浮点数输入输出样例输入 #1复制123.4输出 #1复制4.321//%d输入需要有空格!而%c可以没有 #include<stdio.h>int main(){ char a,b,c,e; char d原创 2021-04-26 19:22:13 · 3778 阅读 · 3 评论 -
OpenJ_Bailian - 2800 垂直直方图
一级标题 OpenJ_Bailian 2800 垂直直方图题目博主学不会C++,用纯C怒打200多行!思路就是全部排列!!!!!#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ char a[100]; int i,j; int count1=0,count2=0,count3=0,count4=0,count5=0原创 2021-04-09 17:42:38 · 185 阅读 · 4 评论 -
HDU 2052 Picture
HDU 2052 Picture题目题目大意 :就是输入两个数字宽度和高度,在每个矩形下面输出一个空行。0.0博主是个连打印图形都不会的菜鸡,这种在大佬眼里的水题干了一下午。不是大家的那种普遍通用算法,是一个一个试出来的0.0思路ac答案#include<stdio.h>int main(){ int n,m; int i,j; while(scanf("%d %d",&n,&m)!=EOF) { for(i=1;i<=m+原创 2021-04-09 17:38:14 · 80 阅读 · 0 评论 -
HDU 入门级递推 ACM入门
HDU 入门级递推 ACM入门HDU 2013 蟠桃记题目思路解答HDU 2018 母牛的故事题目思路解答HDU 2041 超级楼梯题目思路解答HDU 2042 不容易系列之二题目思路解答HDU 2044 一只小蜜蜂题目思路解答HDU 2047 阿牛的EOF牛肉串题目思路解答HDU 1021 Fibonacci Again题目思路解答HDU 2013 蟠桃记题目思路解答ac代码#include <stdio.h>int main(){ int n;原创 2021-04-09 17:29:06 · 164 阅读 · 0 评论