2012年每周一赛第三场第四题。算盘的模拟,没什么好说的。
Run Time: 0sec
Run Memory: 312KB
Code Length: 634Bytes
SubmitTime: 2012-04-01 21:42:20
// Problem#: 5037
// Submission#: 1300038
// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License
// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/
// All Copyright reserved by Informatic Lab of Sun Yat-sen University
#include <iostream>
#include <string>
using namespace std;
int main()
{
int u, v;
string thread[ 6 ];
int i;
while ( cin >> v && v != -1 ) {
for ( i = 0; i < 6; i++ )
cin >> thread[ i ];
u = 0;
for ( i = 0; i < 6; i++ )
u = u * 10 + ( 9 - thread[ i ].find( '-' ) );
u += v;
for ( i = 5; i >= 0; i-- ) {
thread[ i ] = string( 9 - u % 10, 'o' ) + string( 3, '-' ) + string( u % 10, 'o' );
u /= 10;
}
for ( i = 0; i < 6; i++ )
cout << thread[ i ] << endl;
cout << endl;
}
return 0;
}