Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package a_examPreparation1;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- public class GoogleSearches {
- public static void main(String[] args) throws IOException {
- BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
- int days = Integer.parseInt(reader.readLine());
- int usersCountPerDay = Integer.parseInt(reader.readLine());
- double moneyPerSearch = Double.parseDouble(reader.readLine());
- double allMoney = 0;
- for (int i = 1; i <= usersCountPerDay; i++) {
- boolean exclusion = false;
- int words = Integer.parseInt(reader.readLine());
- if (words > 5) {
- continue;
- }
- if (words == 1) {
- if (i % 3 == 0) {
- exclusion = true;
- allMoney += (moneyPerSearch * 2)* 3;
- } else {
- exclusion = true;
- allMoney +=moneyPerSearch * 2;
- }
- } else {
- if (i % 3 == 0) {
- exclusion = true;
- allMoney += moneyPerSearch * 3;
- } else {
- allMoney += moneyPerSearch;
- }
- }
- }
- double result = allMoney * days;
- System.out.printf("Total money earned for %d days: %.2f", days, result);
- }
- }
Add Comment
Please, Sign In to add comment