题目链接:http://abc042.contest.atcoder.jp/tasks/abc042_a Time limit : 2sec / Memory limit : 256MB Score : 100 points Problem Statement Iroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllable…
题目链接:http://abc042.contest.atcoder.jp/tasks/abc042_b Time limit : 2sec / Memory limit : 256MB Score : 200 points Problem Statement Iroha has a sequence of N strings S1,S2,…,SN. The length of each string is L. She will concatenate all of the strings i…
[Arc058E] Iroha and Haiku 题目大意 问有多少\(n\)个数的正整数序列,每个数在\([1,10]\)之间,满足存在\(x,y,z,w\)使得\(x\to y-1,y\to z-1,z\to w\)的和分别为\(X,Y,Z\). \(X,Z\leq 5,Y\leq 7\) 试题分析 由于发现\(X+Y+Z\)和\(a_i\)很小,所以考虑状态压缩,可以用位数来表示数字,比如\(5=10000,1=1\). 然后不合法方案数比合法方案数好求,所以直接求不和法即可. #inc…
\(\mathcal{Description}\)   Link.   称一个正整数序列为"俳(pái)句",当且仅当序列中存在连续一段和为 \(x\),紧接着连续一段和为 \(y\),再紧接着连续一段和为 \(z\),其中 \(x,y,z\) 为给定正整数.计数长度为 \(n\),元素大小不超过 \(10\) 的俳句.   \(n\le40\),\(x+y+z\le17\). \(\mathcal{Solution}\)   通过俳句的特征(连续三段和的限制)来正向计数会重复:一个俳…
目录 ARC 058 E - 和風いろはちゃん / Iroha and Haiku 题意 题解 技巧 代码 ARC 059 F - バイナリハック / Unhappy Hacking 题意 题解 技巧 代码 ARC 060 D - 桁和 / Digit Sum 题意 题解 技巧 代码 F - 最良表現 / Best Representation 题意 题解 技巧 代码 ARC 063 E - 木と整数 / Integers on a Tree 题意 题解 技巧 代码 ARC 065 E - へん…
A - こだわり者いろはちゃん / Iroha's Obsession(暴力) 题目链接 题目大意: 给你 \(k\) 个个位数字和一个数字 \(n\) ,要求找到一个大于等于n的数字,使得不出现 \(k\) 个数. 大致思路: 直接枚举就行了,最多枚举到多一位. 代码: #include<bits/stdc++.h> using namespace std; int n,k; int vis[20]; bool check(int x){ while(x){ int d=x%10; x/=1…
csp退役前的做题计划1(真) 因为我太菜了,所以在第一次月考就会退役,还是记录一下每天做了什么题目吧. 任务计划 [ ] Z算法(Z Algorithm) 9.28 [x] ARC061C たくさんの数式 / Many Formulas [x] ARC061D すぬけ君の塗り絵 / Snuke's Coloring [x] ARC061E すぬけ君の地下鉄旅行 / Snuke's Subway Trip [x] ARC061F 3人でカードゲーム / Card Game for Three […
ARC058 C - こだわり者いろはちゃん / Iroha's Obsession 暴力一个个枚举是最简单的方式 #include <bits/stdc++.h> #define fi first #define se second #define pii pair<int,int> #define mp make_pair #define pb push_back #define space putchar(' ') #define enter putchar('\n') #d…
这个应该是第一场有英文的atcoder吧??不过题解却没有英文的... 从前往后慢慢做... C こだわり者いろはちゃん / Iroha's Obsession 数据范围这么小,直接暴力 #include <bits/stdc++.h> using namespace std; bool rec[10]; bool check(int num) { while(num) { if(rec[num%10]) return false; num /= 10; } return true; } in…
D - Iroha and Haiku (New ABC Edition) 题意: 找一个最少含有三个点的区间,将区间分成三块,三块的和分别为p,q,r,问是否存在这样的区间 题解:先预处理一遍前缀和,和每一个前缀和出现的位置,然后从前往后遍历,每次遍历当前位置的前缀和,如果当前位置的前缀和>=(p+q+r),那么就有可能存在符合条件的区间,在看是否存在前缀和为 sum-p-q-r的点,如果有再判断区间内部是否符合即可. #include<bits/stdc++.h> using nam…