This following code segment I ain't able to debug. The output is saying that
Aborted (core dumped) [1] + Aborted (core dumped) "/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-kgwsird3.a0t" 1>"/tmp/Microsoft-MIEngine-Out-j3ssuqn2.lsi"
'''Note that, I am using gdb in Linux and using Visual Studio as code editor.'''
#include <iostream>
int main() {
int tt;
std::cin >> tt;
while(tt--) {
int n;
std::cin >> n;
int h, m;
std::cin >> h >> m;
int time = 60 * h + m, ans = 24 * 60;
for(int i = 0; i < n; ++i) {
std::cin >> h >> m;
int t = 60 * h + m - time;
if(t < 0) t += 24 * 60;
ans = (ans < t ? ans : t);
}
std::cout << ans / 60 << " " << ans % 60 << '\n';
}
return 0;
}
Aucun commentaire:
Enregistrer un commentaire