1. Java, Till Fischer

/*

 ============================================================================

 Name            : Main.java

 Author            : Till Fischer

 Description    : 10127 - Ones

 Accepted        : Accepted

 Time            : 0.100

 ============================================================================

 */



import java.io.BufferedReader;

import java.io.BufferedWriter;

import java.io.IOException;

import java.io.InputStreamReader;

import java.io.OutputStreamWriter;



public class Main {



    public static void main(String[] args) throws NumberFormatException, IOException {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

        int n, counter;

        int r;

        while(reader.ready()) {

            n = Integer.parseInt(reader.readLine());

            if(n == 1) {

                writer.write(1 + "\n");

                continue;

            }

           

            r = 11;

            counter = 2;

            while(r % n != 0) {

                counter++;

                r = (10*r + 1) % n;

            }

            writer.write(counter + "\n");

           

        }

        writer.flush();

        writer.close();

        reader.close();

    }



}

2. C++, Evgeni Pavlidis, AC

#include <iostream>

using namespace std;

int main()
{
int n;
while(true)
{
cin >> n;
if(feof(stdin))
return 0;

long long int r = 1;
int counter = 1;

while(r)
{
counter++;
r = (r*10 + 1)%n;
}

cout << counter << endl;
}
}