大水题,不想说什么,我在头脑非常不清醒的状态下1A #include <iostream> using namespace std ; const int maxn = 100 + 10 ; int party[maxn] ; bool visit[36500 +10] ; void init() { memset( party , 0 , sizeof( party ) ) ; memset( visit , 0 , sizeof( visit ) ) ; return ; } int main() { int ncase ; cin >> ncase ; while( ncase-- ) { init() ; int nday ; cin >> nday ; int nparty ; cin >> nparty ; int max = 0 ; for( int i = 0 ; i < nparty ; i++ ) cin >> party[i] ; int flag = 0 ;//标记是否有一的情况 for( int i = 0 ; i < nparty ; i++ ) if( party[i] == 1 ) { flag = 1 ; break ; } if( ! flag ) for( int i = 1 ; i <= nday ; i++ ) { if( i % 7 != 6 && i % 7 )//不是休息日 for( int j = 0 ; j < nparty ; j++ ) if( ! ( i % party[j] ) )//第i天有人罢工 { visit[i] = true ; break ; } } if( flag ) cout << nday << endl ;//如果有一说明每天都有人罢工 else { int count = 0 ; for( int i = 1 ; i <= nday ; i++ ) if( visit[i] ) count++ ;//统计有人罢工的天数 cout << count << endl ; } } return 0 ; }