summaryrefslogtreecommitdiff
path: root/033.c
diff options
context:
space:
mode:
authorReiner Herrmann <reiner@reiner-h.de>2014-08-31 20:21:45 +0200
committerReiner Herrmann <reiner@reiner-h.de>2014-08-31 20:35:09 +0200
commit95341b61b030c9e1290f3b326cb7ec584f543aea (patch)
tree852386fa04d32eb859bca11c0eff7b5ef9e50f00 /033.c
parent571164d977f91925c4c76a292f74f5f93d09ae23 (diff)
moved files to higher directory after split to new repositoryHEADtrunk
Diffstat (limited to '033.c')
-rw-r--r--033.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/033.c b/033.c
new file mode 100644
index 0000000..61a7ffd
--- /dev/null
+++ b/033.c
@@ -0,0 +1,59 @@
+
+int curious_fraction(int a, int b)
+{
+ int a1 = a/10;
+ int a2 = a%10;
+ int b1 = b/10;
+ int b2 = b%10;
+
+ float result = 1.0*a/b;
+
+ if(a2 == 0)
+ return 0;
+
+ if(a1 == b1)
+ {
+ float result2 = 1.0*a2/b2;
+ if(result == result2)
+ return 1;
+ }
+
+ if(a1 == b2)
+ {
+ float result2 = 1.0*a2/b1;
+ if(result == result2)
+ return 1;
+ }
+
+ if(a2 == b1)
+ {
+ float result2 = 1.0*a1/b2;
+ if(result == result2)
+ return 1;
+ }
+
+ if(a2 == b2)
+ {
+ float result2 = 1.0*a1/b1;
+ if(result == result2)
+ return 1;
+ }
+
+ return 0;
+}
+
+int main()
+{
+ int a, b;
+ float product = 1.0;
+
+ for(a=10; a<100; a++)
+ for(b=a+1; b<100; b++)
+ if(curious_fraction(a, b))
+ product *= 1.0*a/b;
+
+ printf("%d\n", (int)(1/product));
+
+ return 0;
+}
+