逛了一圈,似乎很少有比我更简单的做法。 先上代码: include <bits/stdc++.h> using namespace std ; int main(){ int n ,count=0; cin >> n ; for(int i = 0;n-(5*i)>=0;i++){ for(int j=0 ;(n-(5*i))-(2*j)>=0;j++){ count++ ; } } cout << count ; } 不妨先假设不用5元人民币兑换。这种情况下,每用一张2元纸币就多了一种兑换方式。比如,8块有四种兑换方式。 那么按照这个逻辑,...