fork download
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. #define taskname "phuongtrinhbacnhat"
  4. using namespace std;
  5. int a,b,x;
  6.  
  7. void nhap(){
  8. cin>>a>>b;
  9. }
  10. void giai(){
  11. if (a==0){
  12. cout<<"nosolution";
  13. }
  14. else {
  15. x=-b/a;
  16. cout<<x;
  17. }
  18. }
  19. int main() {
  20. if(fopen(taskname".inp","r")){
  21. freopen(taskname".inp","r",stdin);
  22. freopen(taskname".out","w",stdout);
  23. }
  24. nhap();
  25. giai();
  26. return 0;
  27. }
Success #stdin #stdout 0s 5316KB
stdin
1 2
stdout
-2