4849: 【GESP2506二级】数三角形

内存限制:1024 MB 时间限制:1.000 S
评测方式:文本比较 命题人:
提交:1 解决:1

题目描述

样例输入 复制

3

样例输出 复制

3

提示

#include <iostream>
using namespace std;
int main()
{
    int n, a, b, cnt=0;
    cin >> n;
    for(a=1; a<=n; a++)
    {
        for(b=a; b<=n; b++)
        {
            if(a*b%2==0) cnt++;
        }
    }
    cout << cnt <<endl;
    return 0;
}