Advertisement
rotti321

B.2. Degustare de ciocolată [Model UBB2019]

Jan 10th, 2022
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ///B.2. Degustare de ciocolată
  2. https://www.cs.ubbcluj.ro/wp-content/uploads/Model-Informatica-Admitere-2019-RO.pdf
  3.  
  4. #include <bits/stdc++.h>
  5.  
  6. using namespace std;
  7.  
  8.  
  9. int main() {
  10. int n,k,r,a,b;
  11. cin>>n>>k;
  12. a=n;
  13. b=k;
  14. while(b!=0)
  15. {
  16. r=a%b;
  17. a=b;
  18. b=r;
  19. }
  20. //cmmdc=a
  21. cout<<n-n/a;
  22. return 0;
  23. }
Advertisement
RAW Paste Data Copied
Advertisement