We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- STL
- Print Pretty
- Discussions
Print Pretty
Print Pretty
Sort by
recency
|
177 Discussions
|
Please Login in order to post a comment
my answers are matched with test cases but can't passed the test cases
include
include
using namespace std;
int main() { int T; cin >> T; cout << setiosflags(ios::uppercase); cout << setw(0xf) << internal; while(T--) { double A; cin >> A; double B; cin >> B; double C; cin >> C; int integer=A; int devident=integer;//100 int devisor=16; string hexa=""; string tempString=""; int length=0; int rem;
while(devident) {
int temp=devident/devisor; rem=devident%devisor; devident=temp; if(rem<10){ tempString=48+rem; hexa=tempString+hexa; } else{ tempString=87+rem; hexa=tempString+hexa;
my answers are matched with test cases but can't passed the test cases
include
include
using namespace std;
int main() { int T; cin >> T; cout << setiosflags(ios::uppercase); cout << setw(0xf) << internal; while(T--) { double A; cin >> A; double B; cin >> B; double C; cin >> C; int integer=A; int devident=integer;//100 int devisor=16; string hexa=""; string tempString=""; int length=0; int rem;
while(devident) {
int temp=devident/devisor; rem=devident%devisor; devident=temp; if(rem<10){ tempString=48+rem; hexa=tempString+hexa; } else{ tempString=87+rem; hexa=tempString+hexa;
WHAT'S WRONG WITH MY CODE?
}
I think the test cases are faulty.
This is actually problematic. Works with certain commands but fails when done step by step because of rounding errors in the test cases (sometimes 0.5 is rounded up and sometimes down).