Skip to content

Instantly share code, notes, and snippets.

@Inazuma110
Last active December 4, 2018 06:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Inazuma110/a06381aa782dc4db08bb9cdb503029dd to your computer and use it in GitHub Desktop.
Save Inazuma110/a06381aa782dc4db08bb9cdb503029dd to your computer and use it in GitHub Desktop.
XMLPro C++Part3 講義用
#include <iostream>
using namespace std;
// int my_max(int a, int b){
// if(a > b) return a;
// else return b;
// // return (a > b) ? a : b;
// }
int main(){
cout << max(4.0, 9.5) << endl;
cout << min(-34, 1) << endl;
// cout << my_max(3, -2) << endl;
}
#include <bits/stdc++.h> // 全部使えるようになるやつ
using namespace std;
int gcd(int a, int b)
{
while(a != 0)
{
int big = max(a, b);
int small = min(a, b);
a = big % small;
b = small;
}
return b;
}
int main(){
cout << gcd(780, 300) << endl;
}
int gcd(int a, int b)
{
if(b == 0) return a;
else return gcd(b, a % b);
// return (b == 0) ? a : gcd(b, a % b);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment