AcWing 5615. 爸爸,n是什么? —— 直接手撸一遍不过分吧
原题链接
简单
#include <iostream>
using namespace std;
const int N = 15;
int f[N];
int main(){
int n;
cin >> n;
f[1] = 1;
f[2] = 1 + 1;
f[3] = 1 + 1;
f[4] = 1 + 1 + 1;
f[5] = 1 + 1 + 1;
f[6] = 1 + 1 + 1;
f[7] = 1 + 1;
f[8] = 1 + 1;
f[9] = 1;
f[10] = 1;
cout << f[n] << endl;
return 0;
}
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int cnt = 0;
for (int i = 0; i <= 5; i ++)
for (int j = i; j <= 5; j ++)
if (i + j == n) cnt ++;
cout << cnt << endl;
return 0;
}