SRM-697-DIV2
2016-08-19 11:26
453 查看
Div2 Medium: DivisibleSetDiv2
|
We are asked if there exists a sequence of powers of two (a0,a1,...,an−1)(a0,a1,...,an-1) that for every i:
Finally, we should avoid losing accuracy in order to use the perfect formula. Casuing the range of bi is [1, 10], we can multiply a constant C which equal to LCM(1,...,10).
public string isPossible(vector<int> b) { int LCM = 2520, sum = 0; for (int bi : b) sum += LCM / bi; // sum up 1/b multiplied by LCM to avoid floats return (sum <= LCM) ? "Possible" : "Impossible"; }
Recently, I had met two mathematical problems. The last one is hihoCoder_5 using log to get the maximum value.
____+++++____
相关文章推荐
- TopCoder SRM 697 div1
- SRM 667 DIV2 OrderOfOperationsDiv2 500-point
- SRM 697 div1 hard
- SRM 628 DIV2
- SRM 554 div2
- 【TopCoder】SRM152 DIV2总结
- TC SRM 548 DIV2
- 【Topcoder】SRM158 DIV2总结
- topcoder 记录 srm 144 div2
- SRM 548 DIV2
- SRM 697 div2 550 推公式
- [Prufer序列推论] SRM 697 div1 ConnectedStates
- SRM 513 div2
- topcoder srm 697 div1 -3
- SRM 504.5 DIV2
- srm 552 div2
- SRM 585 DIV2
- SRM 546 div2
- SRM 574 250 DIV2
- TopCoder SRM 360 DIV2 500 分题目, 需要排列组合么?需要强力法么?