nassss

Untitled

Jan 14th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4.  
  5. namespace _5._PageCalculator
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. List<string> words = Console.ReadLine()
  12. .Split(new[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries)
  13. .ToList();
  14. double wordsPerPage = double.Parse(Console.ReadLine());
  15. string keyword = Console.ReadLine();
  16. if (words.Contains(keyword))
  17. {
  18. int position = words.LastIndexOf(keyword);
  19. double output = Math.Ceiling(++position / wordsPerPage);
  20. Console.WriteLine(output);
  21. }
  22. else
  23. {
  24. Console.WriteLine("-1");
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment