Saturday, May 13, 2017

URI Solution 1213 Ones - Solution in C, C++

URI Solution 1213 Ones - Solution in C, C++


URI Online Judge Solution  1213 Ones | Data structures
URI Main Problem Link - 1213 Ones https://www.urionlinejudge.com.br/judge/en/problems/view/1213

Problem Name: URI Problem 1213 Ones
Problem Number : URI Problem 1213 Ones Solution



 Online Judge : URI Online Judge Solution
Level: Data structures
Solution Language : C, C plus plus

URI Solution 1213 Ones - Solution in C, C++

URI Solution 1213 Ones Code in C:

#include <stdio.h>
 
int main(int argc, char const *argv[])
{
 long long int n, l, c;
 
 while(scanf("%lli", &n) == 1){
  l = 1;c = 1;
 
  while(l % n != 0){
   l = (10 * l + 1) % n;
   c++;
  }
 
  printf("%lli\n", c);
 }
 
 return 0;
}


URI Solution 1213 Ones Code in C++:

#include <cstdio>
 
using namespace std;
 
int main(int argc, char const *argv[])
{
 long long int n, l, c;
 
 while(scanf("%lli", &n) == 1){
  l = 1;c = 1;
 
  while(l % n != 0){
   l = (10 * l + 1) % n;
   c++;
  }
 
  printf("%lli\n", c);
 }
 
 return 0;
}



Tags: Uri solve , Uri solution, URI oj Solve, URI Online Judge Solution list, URI 1213 solution in C, URI 1213 solution in C++, URI Ones Solution, URI 1213 code in C, URI 1213 code in C++

No comments:
Write comments

To know more about the problem, give us your valuable commment. We'll try to help you. Thanks

All rights reserved ©2016 -URI ONLINE JUDGE SOLUTION | Developed by Maniruzzaman Akash

© 2016 URI ONLINE JUDGE SOLUTION. Developed by Maniruzzaman Akash | Distributed By Gooyaabi Templates
Powered by Blogger.