思维题
文章平均质量分 82
0824Snow
这个作者很懒,什么都没留下…
展开
-
Restore the Permutation by Merger(思维) CF - 1385B
题意: 一个[1,n]长度为n的数组,复制一个相同的数组,将原数组插入到新数组中,使得前后顺序不变,给定插入后的数组,找到原数组。 思路: 遍历一遍,输出序列中当前没有出现过的数字即可。 Code: #include<iostream> #include<cstring> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; ..原创 2020-08-01 11:07:56 · 261 阅读 · 0 评论 -
New Year and Counting Cards(for(auto)循环+思维) CF-908A
题意: 一堆卡片,每个卡片两面分别写着字母和数字;验证 "元音字母’a’,‘e’,‘i’,‘o’,'u’后面一定是偶数"命题成不成立。我们可以翻卡片来检查,问最少需要翻多少次 分析: 元音字母:翻 辅音字母:不翻 奇数:翻 偶数:不翻 Code: #include<iostream> using namespace std; int main(){ string a; cin>>a; int t=0; for(auto &c:a) //即fo...原创 2020-07-24 18:54:21 · 135 阅读 · 0 评论 -
Shaolin (map)HDU - 4585
Shaolin Shaolin temple is very famous for its Kongfu monks.A lot of young men go to Shaolin temple every year, trying to be a monk there. The master of Shaolin evaluates a young man mainly by his talent on understanding the Buddism scripture, but fightin转载 2020-07-07 21:21:59 · 119 阅读 · 0 评论 -
Misha and Changing Handles(map+思维)
Knowledge point ①map: count() 返回指定元素出现的次数 find() 查找一个元素并返回其所在位置 erase() 删除一个元素 clear() 删除所有元素 begin() 返回指向map头部的迭代器 end() 返回指向map末尾的迭代器 size() 返回map中元素的个数 (*it).first会得到key,(*it).second会得到value, 等同于it->first和it->se...原创 2020-07-07 20:36:14 · 255 阅读 · 0 评论 -
AbuTahun and Flash Memories(思维题)
Abu Tabun and Flash Memories 题意: n个文件,每个文件xGB,一个闪存能存aGB,每个文件不能分开,求至少需要多少闪存 思路: Ans=(n+[a/x]−1)/[a/x] 代码: #include<bits/stdc++.h>//万能头文件 using namespace std; int n,x,a; int main() { scanf("%d%d%d",&n,&x,&a); int b=a/x; ..原创 2020-07-04 22:10:21 · 155 阅读 · 0 评论