Skip to content

Instantly share code, notes, and snippets.

@allen501pc
Created September 5, 2011 08:22
Show Gist options
  • Save allen501pc/1194419 to your computer and use it in GitHub Desktop.
Save allen501pc/1194419 to your computer and use it in GitHub Desktop.
教育部專用計算程式
#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