Created
September 5, 2011 08:22
-
-
Save allen501pc/1194419 to your computer and use it in GitHub Desktop.
教育部專用計算程式
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
/* 總金額 */ | |
#define _SUM_OF_DOLLARS 20800 | |
/* Dollars of Item 1. */ | |
#define _ITEM_1 170 | |
/* Dollars of Item 2. */ | |
#define _ITEM_2 870 | |
int main(int argc, char * argv[]) | |
{ | |
int sum = 0; | |
for( int i =0; i< _SUM_OF_DOLLARS/_ITEM_1; ++i) | |
{ | |
sum = _SUM_OF_DOLLARS; | |
sum -= i*_ITEM_1; | |
if(sum % _ITEM_2 ==0) | |
{ | |
cout << _ITEM_2 <<"元 x " << (sum/_ITEM_2) << " 千字,圖片稿" << _ITEM_1 << "元 x " << i << "張" << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment