2018年4月27日 星期五

P1 TAB 小考1範例


P1(TAB) 小考1範例

程式1      (1) 1   __1912__
int y;       (2)100  _2011__
cin >> y; 
cout << y+1911 << endl; 
程式2      (1) 5 2  __10__
int h , w ;    (2) 3 4  __12__
cin >> h >> w; 
cout << h*w << endl; 
程式3      (1) 1 2  __62__
int h,m;     (2) 3 4  __184__
cin >> h >> m; 
cout << h * 60 + m << endl;
程式4   (1) 2   __P1x__
int n;     __P1x__
cin >> n;
int i;
for( i=1; i<=n; ++i )
{
   cout << "P1x" << endl;
} 
程式5      (1) 55   __F__
 int sco;     (2) 66   __P__
 cin >> sco; 
  if ( sco<60 )
     cout <<"F\n";
  else
     cout << "P" << endl;
程式6     (1) 1   __D__
int n ;      (2) 2   __V__
  cin >> n; 
  if ( n%2 == 1 )
      cout <<"D\n"; 
  else   
      cout << "V\n";
程式7      (1) 2500   __L__
int y;       (2) 2100   __N__
  cin >> y; 
  if( y%250==0 || ( y%4==0 && y%100 != 0 ) ) 
       cout <<"L\n"; 
else cout <<"N\n";
程式8         (1) 16 10   __N__
int t, h,m;       (2) 13 20   __Y__
 cin >> h >> m; 
 t = h*60 + m;
 if( t >= 800 && t <= 960 )    cout << "Y\n"; 
 else   cout <<"N\n";   
程式9      (1) 24   __3__
  int n; 
   cin >> n;  
   while( n%2==0 )
   { 
        n /= 2;  
   } 
   cout << n << endl; 
程式10     (1) 2100   __3__
  int n ,m , cnt=0; 
    cin >> n >> m; 
   while( n<m ) 
   { 
      ++cnt; 
      n*=3; 
   } 
   cout << cnt << endl; 
程式11    (1) 5   __6__
   int n ,m, cnt=1 ; 
    cin >> n ; 
   while( n>1 ) 
   { 
      ++cnt; 
      if( n%2==0 ) n /= 2; 
      else n = n*3 + 1; 
   } 
   cout << cnt << endl; 
程式12    (1) 543   __345__
int n;
cin >> n;
int sum = 0;
while( n != 0 )
{
  sum = sum * 10 + ( n%10 );
  n /= 10; 
}
cout << sum << endl;
程式13    (1) 2 4   __0__
int a,b , tot=0; 
  cin >> a >> b; 
  if( b%3==2 ) tot += 200;
  if( a%2 ) tot += 100;
  if( a==b )  tot += 50;
  cout << tot << endl;
程式14    (1) 3   __3 2 1 0__
int i,n;
cin >> n ;
for (  i=n; i>=0  ; --i  )
{
   cout << i << " ";
}
cout << endl; 


Related Posts:

  • P1TAB小考模卷 填充計算題:每格3分(9~16各算2格) 1.16位元無號整數可表示的範圍為:__________ ~ _______________ 2.32位元以2的補數存整數可表示的範圍為:__________ ~ _______________ 3.將容量單位{EB,GB,KB,MB,TB}由大至… Read More
  • P1TAB(106下之1) 數字系統、a031~a034 106下普1資概-第1次小考模擬(a) 1.16位元無號整數可表示的範圍為:__________ ~ _______________ 2.32位元以2的補數存整數可表示的範圍為:__________ ~ _______________ 3.將二進位整數(&… Read More
  • To P1 TAB (資概期末-2)作業解 選擇題: 1.        ( C ) 俊佑為了讓家中的電腦,可以播放自己收藏的藍光影片,想將電腦原配有的26倍速DVD-ROM更換為一台讀取資料速度相同的藍光光碟機,試問他該購買下列何種倍速的藍光光碟機? (A)… Read More
  • P1 TAB (323~326)+(416~420) A004 , a005 , a006    , a007, a008, a009 ,      a010 , A011, a012,    a014,a015, &nb… Read More
  • To P1 TAB (資概期末-3)Cpp P1 TAB之期末 C++變化題範例 1/9更新:有想考友誼數、水仙花數、分數相加化簡 、 孿生質數    哦! 一、1061_u3-1_prime 輸入一個正整數 n , 0<n<46000 ,若 n 為質數則印出 Prime,否則印出… Read More

0 意見:

張貼留言