Show More
Commit Description:
update run
Commit Description:
update run
References:
File last commit:
Show/Diff file:
Action:
test/data/test2_05sec.c | 40 lines | 629 B | text/x-c | CLexer |
jittat
[grader] added fractional timelimit...
r51 #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <time.h>
#include <sys/resource.h>
// run it for 1.5 s
int main()
{
int a,b;
int c=0;
jittat
fixed engine test source codes to avoid gcc warning of unused return values...
r75 int r;
jittat
[grader] added fractional timelimit...
r51
jittat
fixed engine test source codes to avoid gcc warning of unused return values...
r75 r = scanf("%d %d",&a,&b);
jittat
[grader] added fractional timelimit...
r51 printf("%d\n",a+b);
struct rusage ru;
while(1) {
c++;
b+=c;
while(c<100000) {
c++;
b+=c;
}
getrusage(RUSAGE_SELF,&ru);
double rtime = ru.ru_utime.tv_sec + ru.ru_stime.tv_sec;
rtime += (double)ru.ru_utime.tv_usec / 1000000.0;
rtime += (double)ru.ru_stime.tv_usec / 1000000.0;
if(rtime > 0.5)
break;
}
printf("%d\n",b);
Jittat Fakcharoenphol
fixed grader to work with ruby 1.9
r137 a += r;
jittat
[grader] added fractional timelimit...
r51 exit(0);
}