钱币兑换

看有多少个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\n",count);
20     }
21 }

 

posted @ 2019-07-31 17:09  Practical  阅读(193)  评论(0编辑  收藏  举报