Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- int A = n % 10;
- int B = (n / 10) % 10;
- int C = n / 100;
- int brojac = 0;
- for(int i = 100; i <= 999; i += 1) {
- int a = A;
- int b = B;
- int c = C;
- int last_digit = i % 10;
- if(last_digit == a) {
- a = -1;
- }
- else if(last_digit == b) {
- b = -1;
- }
- else if(last_digit == c) {
- c = -1;
- }
- int middle_digit = (i / 10) % 10;
- if(middle_digit == a) {
- a = -1;
- }
- else if(middle_digit == b) {
- b = -1;
- }
- else if(middle_digit == c) {
- c = -1;
- }
- int first_digit = i / 100;
- if(first_digit == a) {
- a = -1;
- }
- else if(first_digit == b) {
- b = -1;
- }
- else if(first_digit == c) {
- c = -1;
- }
- if(a == -1 and b == -1 and c == -1) {
- brojac += 1;
- }
- }
- cout << brojac << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement