My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using System;

namespace Hef.TopCoder.Srm145.Div2
{
public class ExerciseMachine
{
public int getPercentages(string time)
{
string[] hms = time.Split(':');
int seconds = (Int32.Parse(hms[0]) * 60 * 60) + (Int32.Parse(hms[1]) * 60) + Int32.Parse(hms[2]);

int fragments;
for (fragments = 100; fragments > 1; fragments -= 1)
// IF 100 percentage points can be evenly divided into `fragments` fragments (i.e. verify whole percentage)
// AND seconds can be evenly divided into `fragments` fragments (i.e. verify whole second)
if (100 % fragments == 0 && seconds % fragments == 0)
break;

return fragments - 1;
}
}
}

Change log

r5 by jonathan.hefner on Jun 22, 2008   Diff
Sync
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 719 bytes, 22 lines
Powered by Google Project Hosting