fork download
  1. #include <iostream>
  2. #include <algorithm>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. int powe(int x, unsigned int y)
  7. {
  8. if( y == 0)
  9. return 1;
  10. else if (y%2 == 0)
  11. return powe(x, y/2)*powe(x, y/2);
  12. else
  13. return x*powe(x, y/2)*powe(x, y/2);
  14.  
  15. }
  16.  
  17. int main(){
  18. int bx,n1,by,n2;
  19.  
  20. int x[n1];
  21. int yi[n2];
  22.  
  23. cin >> n1 >> bx;
  24. for(int i = 0; i < n1; i++){
  25. cin >> x[i];
  26. }
  27.  
  28. int power = 0;
  29. int sum = 0;
  30. for(int s = n1 - 1; s >= 0 ;s--){
  31. int r = powe(bx,power);
  32. int l = x[s] * r;
  33. sum = sum + l;
  34. power++;
  35. }
  36. sum;
  37. cin >> n2 >> by;
  38.  
  39. for(int i = 0; i < n2; i++){
  40. cin >> yi[i];
  41. }
  42.  
  43.  
  44. int po = 0;
  45. int sum1 = 0;
  46. for(int s = n2 - 1; s >= 0; s--){
  47. int t = powe(by,po);
  48. int l = yi[s] * t;
  49. sum1 = sum1 + l;
  50. po++;
  51. }
  52.  
  53. if(sum > sum1){
  54. cout << ">" << endl;
  55. }
  56.  
  57. if(sum < sum1){
  58. cout << "<" << endl;
  59. }
  60.  
  61. if(sum == sum1){
  62. cout << "=" << endl;
  63. }
  64.  
  65.  
  66.  
  67. }
Runtime error #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
Standard output is empty