标签:get while char b2c isp \n lap bsp sed
A(HDU6124)
#include <bits/stdc++.h> using namespace std ; int INPUT ( ) { int x=0,f=1;char ch=getchar(); while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();} while(ch>=‘0‘&&ch<=‘9‘){x=(x<<1)+(x<<3)+ch-‘0‘;ch=getchar();} return x*f ; } int main ( ) { for ( int T = INPUT ( ) ; T ; --T ) { int N = INPUT ( ) ; if ( N & 1 ) cout << ( N / 2 ) + 2 << endl ; else cout << ( N / 2 ) + 1 << endl ; } return 0 ; }
#include <bits./stdc++.h> using namespace std ; int main ( ) { int N ; int buc[ 100 ] ; cin >> N ; for ( int i=1 ; i<=N ; ++i ) cout << i << ‘\t‘ ; putchar( ‘\n‘ ) ; for ( int i=1 ; i<=N ; ++i ) { memset ( buc , 0 , sizeof ( buc ) ) ; int _cnt= 0 ; for ( int j=1 ; j<=i + 1 ; ++j ) { buc[ i % j ] = true ; } for ( int i=0 ; i<=N+1 ; ++i ) { if ( buc[ i ] ) ++ _cnt ; } cout << _cnt << ‘\t‘ ; } return 0 ; }
标签:get while char b2c isp \n lap bsp sed
原文地址:https://www.cnblogs.com/shadowland/p/9880163.html