0

Basic Concepts - Transportation Tasks

Hi there )) Need help I don’t know how to complete the transportation tasks. I did the first test case#1 When I tried to do the second test case#2, the test case#1 is Shown as false. :/

29th Nov 2020, 3:27 PM
Bekxan
6 Antworten
+ 9
Bekxan Pls mention ur programming language and Post the real complete Question and Show us ur attempt for the Question so that we can help u with tht...
29th Nov 2020, 3:33 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 4
I'll give u a Big Hint : cout<<50-(Passengers%50); The Question itself gives the hint to use modulo operator and u haven't included it anywhere... Read the Question a couple of times and think...U'll get the Logic....
29th Nov 2020, 4:33 PM
Alphin K Sajan
Alphin K Sajan - avatar
+ 3
//Transportation int bus=50; //seats per Bus int guests; //total guests cin >>guests; guests %= bus; bus -= guests; cout << bus << endl; // i did it 😂😂 // thank you guys u r awesome!!!
29th Nov 2020, 4:39 PM
Bekxan
+ 3
A simple three lines of code implementation. First, you use the modulus function to find the remainder, which are the passengers on the last bus. Then, to find the empty seats, you use bus capacity minus away the last passengers. https://code.sololearn.com/cAsIKRZH3quK/?ref=app
16th Dec 2020, 12:39 PM
Lam Wei Li
Lam Wei Li - avatar
0
// C++ #include <iostream> using namespace std; int main() { //test case #1 int bus=50; //seats per Bus int guests = 12; //total guests bus -= guests; cout << bus << endl; // output38 // test case #2 bus = 50; guests = 231; guests-=bus; guests-=bus; guests-=bus; guests-=bus; cout << bus - guests <<endl;//19 // test case 3 return 0; }
29th Nov 2020, 3:40 PM
Bekxan
0
You need to calculate the points earned by a soccer team. The team won 18 games and ended 7 games as a draw. A win brings 3 points, while a draw brings 1. answer of 👆
4th Feb 2022, 9:08 AM
Hunter FF