https://www.acmicpc.net/step/4
https://www.acmicpc.net/problem/1330
방법 1
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
if (a > b)
cout << ">" << endl;
else if (a < b)
cout << "<";
else
cout << "==";
return 0;
}
방법 2
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << ((a>b)? ">" : (a<b)? "<" : "==");
return 0;
}
https://www.acmicpc.net/problem/9498
방법 1
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
if (90 <= a && a <= 100)
cout << 'A';
else if (80 <= a && a <= 89)
cout << 'B';
else if (70 <= a && a <= 79)
cout << 'C';
else if (60 <= a && a <= 69)
cout << 'D';
else
cout << 'F';
return 0;
}
방법 2
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
if (90 <= a)
cout << 'A';
else if (80 <= a)
cout << 'B';
else if (70 <= a)
cout << 'C';
else if (60 <= a)
cout << 'D';
else
cout << 'F';
return 0;
}
방법 3
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
cout << ((a >= 90) ? "A" : (a >= 80) ? "B" : (a >= 70) ? "C" : (a >= 60) ? "D" : "F");
return 0;
}
https://www.acmicpc.net/problem/2753
방법 1
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
if (a % 4 == 0)
if (a % 400 == 0)
cout << 1;
else if (a % 100 == 0)
cout << 0;
else
cout << 1;
else
cout << 0;
return 0;
}
방법 2
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
if ((a % 4 == 0 && a % 100 != 0) || a % 400 == 0)
cout << 1;
else
cout << 0;
return 0;
}
방법 3
#include <iostream>
using namespace std;
int main() {
int a;
cin >> a;
cout << ((a % 4 == 0) ? ((a % 400 == 0) ? 1 : (a % 100 != 0) ? 1 : 0) : 0);
return 0;
}
https://www.acmicpc.net/problem/14681
방법 1
#include <iostream>
using namespace std;
int main() {
int x,y;
cin >> x >>y;
if (x > 0 && y > 0)
cout << 1;
else if (x < 0 && y > 0)
cout << 2;
else if (x < 0 && y < 0)
cout << 3;
else if (x > 0 && y < 0)
cout << 4;
return 0;
}
방법 2
#include <iostream>
using namespace std;
int main() {
int x,y;
cin >> x >>y;
cout << (x > 0 ? (y > 0 ? 1 : 4) : (y > 0 ? 2 : 3));
return 0;
}
https://www.acmicpc.net/problem/2884
방법 1
#include <iostream>
using namespace std;
int main() {
int h,m;
cin >> h >> m;
if (m >= 45)
cout << h << ' ' << m - 45;
else if (h != 0)
cout << h - 1 << ' ' << m + 60 - 45;
else
cout << 23 << ' ' << m + 60 - 45;
return 0;
}
방법 2
#include <iostream>
using namespace std;
int main() {
int h,m;
cin >> h >> m;
if (m < 45) {
m += 60;
h--;
if (h < 0) h = 23;
}
cout << h << ' ' << m - 45;
return 0;
}