D. Spongebob and Squares Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/D Description Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of…
http://codeforces.com/problemset/problem/599/D 题意:给出一个数x,问你有多少个n*m的网格中有x个正方形,输出n和m的值. 思路: 易得公式为:$\sum_{i=0}^{n}(n-i)(m-i) $ 化简得:$\left [ n(n+1)-\frac{n(n+1)}{2}\right ]*m+\frac{n(n+1)(n+2)}{6}-\frac{n(n+1)}{2}*n$ 将n作为小的数,枚举n即可. #include<iostream> #i…
D. Spongebob and Squares   Spongebob is already tired trying to reason his weird actions and calculations, so he simply asked you to find all pairs of n and m, such that there are exactly x distinct squares in the table consisting of n rows and m col…
B. Spongebob and Joke Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/599/problem/B Description While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Pat…
Description While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers from 1 to n, not…
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed th…
B. Spongebob and Joke time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed th…
B. Spongebob and Joke     While Patrick was gone shopping, Spongebob decided to play a little trick on his friend. The naughty Sponge browsed through Patrick's personal stuff and found a sequence a1, a2, ..., am of length m, consisting of integers fr…
http://codeforces.com/contest/599/problem/D 题意:给出总的方格数x,问有多少种不同尺寸的矩形满足题意,输出方案数和长宽(3,5和5,3算两种) 思路:比赛的时候gg了..其实稍微在纸上推一下.就会得到对于n,m的矩形,一共会有-n*n*n+3*n*n*m+n+3*n*m的方格.数量级是n3. 我们可以实际跑一遍.发现对于x1E18的数量级,n不会超过1442550,1E6,可以搞. 需要注意的是,一个是会爆int,所以记得用long long 另一个是…
水 A - Patrick and Shopping #include <bits/stdc++.h> using namespace std; int main(void) { int d1, d2, d3; scanf ("%d%d%d", &d1, &d2, &d3); printf ("%d\n", min (min (2 * (min (d1, d2) + d3), 2 * (d1 + d2)), d1 + d2 + d…