Last active
December 4, 2018 06:06
-
-
Save Inazuma110/a06381aa782dc4db08bb9cdb503029dd to your computer and use it in GitHub Desktop.
XMLPro C++Part3 講義用
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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