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.
  • Practice
  • Certification
  • Compete
  • Career Fair
  • Hiring developers?
  1. Practice
  2. Algorithms
  3. Implementation
  4. Beautiful Days at the Movies
  5. Discussions

Beautiful Days at the Movies

Problem
Submissions
Leaderboard
Discussions
Editorial

Sort 1014 Discussions, By:

votes

Please Login in order to post a comment

  • navjotahuja92 4 years ago+ 0 comments

    this :)

    i, j, k = [int(x) for x in input().split()]
    beautifulDays = [1 for day in range(i, j+1) if (day - int(str(day)[::-1])) % k == 0]
    print(sum(beautifulDays))
    
    45|
    Permalink
  • patrickdekelly 4 years ago+ 0 comments

    That Lily girl is loony. Get out while you still can Logan! :P

    15|
    Permalink
  • venkatsaikiran 4 years ago+ 0 comments

    Solution in Java

    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.math.*;
    import java.util.regex.*;
    
    public class Solution {
    
        public static void main(String[] args) {
            /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
            Scanner in = new Scanner(System.in);
            int i = in.nextInt();
            int j = in.nextInt();
            int k = in.nextInt();
            int count = 0;
            
            for (int a=i;j>a; a++){
                StringBuilder temp = new StringBuilder();
                temp.append(a);
                temp=temp.reverse();
                String temp1 = temp.toString();
                int aRev = Integer.parseInt(temp1);
                if(Math.abs((a-aRev)%k)==0){
                    count++;
                }
            }
            
            System.out.println(count);
        }
    }
    
    10|
    Permalink
  • Aswath3167 4 years ago+ 0 comments

    My C Solution......

    #include<stdio.h>
    int main()
    {
    int i=0,j=0,k=0,x=0,rem=0,sum=0,count=0;
    scanf("%d%d%d",&i,&j,&k);
    for(i;i<=j;i++)
    {
    x=i;
    while(x!=0)
    {
    rem=x%10;
    sum=(sum*10)+rem;
    x=x/10;
    }
    if(abs(i-sum)%k==0)
    count=count+1;
    sum=0;
    }
    printf("%d",count);
    return 0;
    }
    
    5|
    Permalink
  • daniel_portik 11 months ago+ 0 comments

    My Python3 solution:

    def beautifulDays(i, j, k):
        daycount = int(0)
        for x in range(i, j+1):
            if (x - int(str(x)[::-1])) % k == 0:
                daycount += 1
        return daycount
    
    4|
    Permalink
Load more conversations

Need Help?


View editorial
View top submissions
  • Contest Calendar
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy
  • Request a Feature