Skip to content

Instantly share code, notes, and snippets.

@flyotlin
Last active November 20, 2019 16:36
Show Gist options
  • Save flyotlin/ec3cd24f05e5d473660f281cbab52d0c to your computer and use it in GitHub Desktop.
Save flyotlin/ec3cd24f05e5d473660f281cbab52d0c to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
long long int k, n;
while(cin >> k && k != 0){
for(int i = 9; i >= 0; i--){
if((10*k-i)%9 == 0){ //先判斷是否整除 而非先直接除再判斷是否為整數
n = (10*k-i)/9.0;
cout << n << " ";
}
}
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment