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. :/

6 Answers

+ 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...

+ 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....

+ 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!!!

+ 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

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;
}

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 đ