Submission #736160

#TimeUsernameProblemLanguageResultExecution timeMemory
736160marvinthangEuklid (COCI20_euklid)C++17
110 / 110
1 ms324 KiB
/******************************
*    author : @marvinthang    *
*    date : 11 / 02 / 2022    *
******************************/

#include <bits/stdc++.h>

using namespace std;

#define   scan_op(...)  istream & operator >> (istream &in, __VA_ARGS__ &u)
#define  print_op(...)  ostream & operator << (ostream &out, const __VA_ARGS__ &u)
#define     superspeed  ios_base::sync_with_stdio(false); cin.tie(nullptr); // cout.tie(nullptr);
#define     file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }

template <class U, class V> print_op(pair <U, V>) { return out << '(' << u.first << ", " << u.second << ')'; }
template <class T> print_op(vector <T>) { out << '{'; for (size_t i = 0; i + 1 < u.size(); i++) out << u[i] << ", "; if (!u.empty()) out << u.back(); return out << '}'; }

const 		int MOD = 1e9 + 7;
const 	  double PI = 3.1415926535897932384626433832795; // acos(-1.0); atan(-1.0);
const 	  int dir[] = {0, 1, 0, -1, 0}; // {0, 1, 1, -1, -1, 1, 0, -1, 0};
const  long long oo = 1e18;
const 		int MAX = 1e5 + 5;



int main(void) {
	superspeed;
	file("coci2021_r2_euklid");
	int t; cin >> t;
	while (t--) {
		long long g, h; cin >> g >> h;
		long long y = h;
		while (y <= g) y *= h;
		y = (y + g - 1) / g * g;
		long long x = h * y + g;
		cout << x << ' ' << y << '\n';
	}
	return 0;
}

Compilation message (stderr)

euklid.cpp: In function 'int main()':
euklid.cpp:13:64: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 | #define     file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                        ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
euklid.cpp:28:2: note: in expansion of macro 'file'
   28 |  file("coci2021_r2_euklid");
      |  ^~~~
euklid.cpp:13:98: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 | #define     file(name)  if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); }
      |                                                                                          ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
euklid.cpp:28:2: note: in expansion of macro 'file'
   28 |  file("coci2021_r2_euklid");
      |  ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...