HDOJ 1170 Balloon Comes!,hdojballoon【題意】:輸入一個符號(加減乘除) 後邊跟上兩個運算元。輸出結果,如果不是整數,保留兩位小數。注意:The result should be rounded to 2 decimal placesIf and only if it is not an integer.需要判斷是不是整數,不是全部保留兩位小數。可以對整個字串分割,或者採用一個char加兩個int的輸入。【AC代碼】:#include <iostream&
BZOJ1406 密碼箱,bzoj1406密碼箱 x2 ≡ 1 (mod n) => x2 = k * n + 1 => n | (x + 1) * (x - 1)設n = a * b,則 (a | x + 1 且 b | x - 1) 或 (a| x - 1 且 b | x + 1)於是暴力 a∈[1,n√]#include <cstdio>#include <set>using namespace
[LeetCode]Find Peak Element,leetcodepeak A peak element is an element that is greater than its neighbors. Given an input array where num[i] ≠ num[i+1], find a peak element and return its index. The array may contain multiple peaks, in
POJ3280Cheapest Palindrome(區間dp),區間dpLanguage:DefaultCheapest PalindromeTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 6227 Accepted: 3032DescriptionKeeping track of all the cows can be a tricky task so
C++ 中的嵌套類和局部類,嵌套部類C++ 中的嵌套類和局部類 最近趁著春節假期空閑,找了本C++ Primer 學了幾章,發現C++ 中的許多特性自己都不知道。其中嵌套類和局部類感覺還是蠻有用的,簡單的寫寫他們的用法。嵌套類所謂嵌套類就是可以在一個類中定義另一個類。這個被嵌套的類的範圍就只在它的上一級類中。下面是個例子:#include <iostream>using
LeetCodeOJ. Valid Parentheses,validparentheses 試題請參見: https://oj.leetcode.com/problems/valid-parentheses/題目概述Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets
POJ 3311 Hie with the Pie (Floyd + 狀壓dp 簡單TSP問題),pojtspHie with the PieTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5019 Accepted: 2673DescriptionThe Pizazz Pizzeria prides itself in delivering pizzas to its customers as fast