paste bin
Author
Language
C++
Plain text
Accesslog
Action script
Ada
Apache
Arduino
Armasm
Autohotkey
Awk
Bash
Basic
Brainfuck
C
Clojure
Cmake
C#
css
D
Delphi
Dockerfile
Erlang
Fortran
F#
Gauss
Go
Gradle
Graphql
Groovy
Haskell
Ini
Java
JavaScript
json
Julia
Kotlin
Lasso
LaTeX
Leaf
lisp
llvm
Lua
Makefile
Markdown
Mathematica
Matlab
Nginx
Objective-C
Ocaml
Oxygene
Perl
PgSQL
php
Powershell
Processing
Profile
Properties
Puppet
Purebasic
Python
Q
QML
R
Ruby
Rust
Scala
Scheme
Scilab
Shell
Smalltalk
SQL
Swift
Typescript
VB.NET
VB Script
Verilog
Vim
Wasm
x86asm
Xml
Xquery
Yaml
source code:
#include <cstdio> int gcd(long long a,long long b) { if (a%b==0) return b; else return gcd(b,a%b); } int main(void) { int T,a1,a2,a3,b1,b2,b3,g; long long num,den; scanf("%d",&T); while(T--) { num=0; den=0; scanf("%d/%d %d/%d %d/%d",&a1,&b1,&a2,&b2,&a3,&b3); num =(long long)a1*b2*b3; num+=(long long)b1*a2*b3; num+=(long long)b1*b2*a3; den=(long long)b1*b2*b3; g=gcd(num,den); printf("%lld/%lld\n",num/g,den/g); } return 0; }
comment: