From 990d4fc5d0945f8d78fdcc8cea6edd1dc3c38446 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Wed, 29 May 2019 16:52:29 +0200 Subject: Resuelto 482 en c++: Los calcetines de Ian Malcolm. --- c/las12uvas/482_losCalcetinesDeIanMalcolm.cpp | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 c/las12uvas/482_losCalcetinesDeIanMalcolm.cpp (limited to 'c/las12uvas') diff --git a/c/las12uvas/482_losCalcetinesDeIanMalcolm.cpp b/c/las12uvas/482_losCalcetinesDeIanMalcolm.cpp new file mode 100644 index 0000000..9d3e8a5 --- /dev/null +++ b/c/las12uvas/482_losCalcetinesDeIanMalcolm.cpp @@ -0,0 +1,30 @@ +#include + +using namespace std; + +int main() { + char i; + char black, grey; + cin >> i; + if ( i != '.' ) + do { + black = 0; + grey = 0; + while (i != '.') { + if ( i == 'N' ) + black = (black+1)%2; + if ( i == 'G' ) + grey = (grey+1)%2; + cin >> i; + } + if (black && grey) + cout << "PAREJA MIXTA\n"; + else if (black) + cout << "NEGRO SOLITARIO\n"; + else if (grey) + cout << "GRIS SOLITARIO\n"; + else + cout << "EMPAREJADOS\n"; + cin >> i; + } while (i != '.'); +} -- cgit v1.2.1