1.


/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, WS09
* Problem: 11703 - sqrt log sin
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=117&page=show_problem&problem=2750
*
* @author Dennis Wilfert
* @version 1.0, 11/26/2009
*
* Status : Accepted
* Runtime: 0.608
*/
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

class Main {

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

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
PrintWriter writer = new PrintWriter(new BufferedOutputStream(System.out));

long[] x = new long[1000001];
// Startwert setzen
x[0] = 1;

// Alle Werte im Array vorberechnen
for (int i = 1; i <= 1000000; i++) {
x[i] = (x[(int) Math.floor(i - Math.sqrt(i))] +
x[(int) Math.floor(Math.log(i))] +
x[(int) Math.floor(i * Math.pow(Math.sin(i), 2))]) % 1000000;
}

int number = Integer.parseInt(reader.readLine());

// Werte an der Position number im Array ausgeben
while (number != -1) {
writer.println(x[number] % 1000000);
number = Integer.parseInt(reader.readLine());
}
writer.flush();
}
}

2.

/**
* ACM Training, SS09
* ACM Problem #11703 sqrt log sin
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=117&page=show_problem&problem=2750

* @author Doina Logofatu
* @version 1.0, 11/20/2009
*
* Method: Math
* Status : Accepted
* Runtime: 0.272
*/

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main(){

long i, *x;

x = (long *)malloc(1000001 * sizeof(long));

*x = 1;

for(i=1; i<=1000000; i++) {
*(x+i) = (x[(long)floor((double)i-sqrt((double)i))] +
x[(long)floor(log((double)i))] +
x[(long)floor((double)i*sin((double)i)*sin((double)i))])%1000000;
}

while(scanf("%ld", &i)==1 && i!=-1)
printf("%ld\n", x[i]);

return 0;
}

3.

/**
* ACM Training, SS09
* ACM Problem #11703 sqrt log sin
* Link: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=117&page=show_problem&problem=2750

* @author Doina Logofatu
* @version 1.0, 11/20/2009
*
* Method: Math
* Status : Accepted
* Runtime: 0.284
*/

#include <stdio.h>
#include <math.h>

int main(){

long i, x[1000001];

x[0] = 1;

for(i=1; i<=1000000; i++) {
x[i] = (x[(long)floor((double)i-sqrt((double)i))] +
x[(long)floor(log((double)i))] +
x[(long)floor((double)i*sin((double)i)*sin((double)i))])%1000000;
}

while(scanf("%ld", &i)==1 && i!=-1)
printf("%ld\n", x[i]);

return 0;
}