0025 - Hit and Blow
#include <iostream> using namespace std; void Slove(int a[]) { int b[4], hit=0, blow=0; for (int i=1; i<4; ++i) cin >> a[i]; for (int i=0; i<4; ++i) cin >> b[i]; for (int i=0; i<4; ++i) for (int j=0; j<4; ++j) if ( a[i] == b[j] ) { if (i == j) ++hit; else ++blow; } cout << hit << " " << blow << endl; } int main(void) { int a[4]; while ( cin >> a[0] ) Slove(a); return 0; }
やるだけ