2009-01-07
SRM377 Div1 Easy: SquaresInsideLattice
8'35''ぐらい。
数が合わないと思って少し悩んでいたらiではなくwを使っていた。orz
Passed System Test / 229.22点
class SquaresInsideLattice {
public:
long long howMany(int width, int height) {
int w=min(width,height);
long long sigma=0;
for(int i=1;i<=w;i++){
sigma += (1LL+width-i)*(1LL+height-i)*i;
}
return sigma;
}
};
コメント
トラックバック - https://topcoder-g-hatena-ne-jp.jag-icpc.org/n4_t/20090107