钱币兑换

看有多少个2和3,其余的都是1

 1 #include <stdio.h>
 2 
 3 int main() {
 4     int count = 0;
 5     int N;
 6     while(scanf("%d",&N)!=EOF){
 7         int count = 0;
 8         {
 9             for (int j = 0; j <= N/2 ; j++)
10             {
11                 for (int k = 0; k <= (N-2*j)/3; k++)
12                 {
13                     if(2*j+3*k<=N){
14                         count++;
15                     }
16                 }
17             }
18         }
19         printf("%d
",count);
20     }
21 }
原文地址:https://www.cnblogs.com/ustc-anmin/p/11277643.html