2018年3月25日 星期日

P1 TAB (323~326)+(416~420)



A004 , a005 , a006    , a007, a008, a009 ,      a010 , A011, a012,   
a014,a015,         a016,a018         a019,a020        a021,a022,a023
int y; 
cin >> y; 
cout << y+1911 << endl; 
int h , w ; 
cin >> h >> w; 
cout << h*w << endl; 
int h,m; 
cin >> h >> m; 
cout << h * 60 + m << endl;
int t; 
cin >> t; 
cout << t/60 <<" " <<t%60 << endl;
int c;    double f; 
cin >> c; 
f = c*9.0/5+32;  
cout << f << endl;
  int n,p; 
  cin >> n; 
  p = (n/11)*1000 + (n%11)*100; 
  cout << p << endl; 
  int g, G, b, p; 
  cin >> g; 
  G=g+3; 
  b=g*2-5; 
  p= b/10*10 + G%10;
  cout << p << endl;
 int sco; 
 cin >> sco; 
  if ( sco<60 )
     cout <<"FAIL\n";
  else
     cout << "PASS" << endl;
 int n ; 
  cin >> n; 
  if ( n%2 == 1 )
      cout <<"ODD\n"; // odd  
  else   
      cout << "EVEN" << endl;
  int a, b, c, x; 
  cin >> a >> b >> c;  
  x = a; 
  if( b < x ) x = b; 
  if( c < x ) x = c;
  cout << x << endl; 
  int a,b; 
  cin >> a >> b; 
  if( a == b ) cout << a << "=" << b << endl; 
  else if( a < b ) cout << a << "<" << b << endl; 
  else cout << a << ">" << b << endl; 
    int y; 
  cin >> y; 
  if( y%400==0 || ( y%4==0 && y%100 != 0 ) ) 
       cout <<"YES\n"; 
else cout <<"NO\n";
 int t, h,m; 
 cin >> h >> m; 
 t = h*60 + m; //轉為總分鐘數 
 if( t >= 860 && t <= 1000 )    cout << "YES\n"; 
 else   cout <<"NO\n";   
int a,b; 
  cin >> a >> b; 
  if( b%3==2 ) cout << "200\n";
  else if( a%2 ) cout << "100\n"; 
  else if( a==b ) cout << "50\n";
  else  cout << "0\n";
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; 
   int n; 
   cin >> n;  
   while( n%2==0 )
   { 
        n /= 2;  
   } 
   cout << n << endl; 
   int n ,m , cnt=0; 
    cin >> n >> m; 
   while( n<m ) 
   { 
      ++cnt; 
      n*=3; 
   } 
   cout << cnt << endl; 
   int n ,m ; 
    cin >> n ; 
    int cnt=1;  //1 
   while( n>1 ) 
   { 
      ++cnt; 
      if( n%2==0 ) n /= 2; 
      else n = n*3 + 1; 
   } 
   cout << cnt << endl; 

題號
輸入
輸出
題號
輸入
輸出
1


9
8
12
32
33

2


10
8
11
9
23
17

3


11
80
60
59
40

4
1
100
199
106
1912



12
1
2
23
36

5
1 2
2 3
5 3
6 4
2
13
90
91
74
75

6
0 10
1 40
13 57
15 0
10

14
1 2 3
3 2 1
5 3 3
4 3 5
3 2 2

7
10
100
300
837

15
2 3
3 2
3 3
3 10

8
31
24
25
32
28

16
1997
2012
2100
2000




a013, a017 , a024,    a025, a026, a027,    a028, a031, a030,    a029, a032    _____,_____,_____
int n ; 
cin >> n; 
if ( n >=75 && n <= 90 )
     cout << "YES" << endl;
else  cout << "NO" << endl;
int n;
cin >> n;
if( n >= 90 ) cout << "A\n"; 
else if( n >= 80 ) cout << "B\n";
else if( n >= 70 ) cout << "C\n";
else if( n >= 60 ) cout << "D\n";
else  cout << "E\n";
int n , sum = 0;
cin >> n;
while( n != 0 )
{
   sum += ( n%10 );
   n /= 10; 
}
cout << sum << endl;
int n;
cin >> n;
int sum = 0;
while( n != 0 )
{
  sum = sum * 10 + ( n%10 );
  n /= 10; 
}
cout << sum << endl;
int n;
cin >> n;
int i;
for( i=1; i<=n; ++i )
{
   cout << "I love you." << endl;
int i,n;
cin >> n ;
for (  i=n; i>=0  ; --i  )
{
   cout << i << " ";
}
cout << endl; 
int i,n,r;
cin >> n >> r;
int p=1;
for (  i=0; i<r  ; ++i  )
{
  p = p*(n-i);
}
cout << p << endl; 
long long a,b;
  cin >> a >> b;
  if( a>b) cout << "A ";
  else cout << "B ";
 
  cout << a+ b << endl;
int a,b,s=0;
cin>>a>>b;
if(a<b)
{
   for(a=a;a<b;a++)
{
       cout<<a<<"+";
       s=s+a;
}
   cout<<b<<"="<<s+b;
}
else if(a>b)
{
   for(a=a;a>b;a--)
{
      cout<<a<<"+";
      s=s+a;
}
   cout<<b<<"="<<s+a;
}
else cout<<a<<"="<<b;
int a,b;
while( cin >> a >> b )
{
   int ans=a;
   cout <<a;
   for(int i=a+1; i<=b; ++i)
   {
      cout <<"+"<<i;
      ans += i;
   }
   cout << "=" << ans << endl;
}
int a,b;
char c;
cin >> a >> c >> b ;
if( c== '+' )
cout << a+b << endl;
else  if( c== '-' )
cout << a-b << endl;
else  if( c== '*' )
cout << a*b << endl;






題號
輸入
輸出
題號
輸入
輸出
17
90
89
80
79
70
69
60
59
A
B
B
C
C
D
D
E
25
12345
1997
543
56789
1000






18
14 20
16 40
16 41
14 19
YES
YES
NO
NO
26
3
2
5
1




19
1 3
2 5
6 6
2 0
100
200
50
0
27
3
5
4
2
8




20
5 5
3 5
2 2
2 5
1 3
6 6
2 0
350
300
250
200
100
50
0
28
3 1
5 3
7 2
6 4
8 3




21
20
32
11
6
107520




29
1 3
1 5
2 5
3 6
10 13




22
1 10
2 10
3 50
3 81
2 162




30
1 3
3 1
5 2
6 3
10 13




23
3
12
7
5
13




31
100000000001 100000000000
666666666666 777777777777
12345678901 87654321199
812345678901 87654321198




24
12345
1997
543
56789
1000




32
12+23
12-35
3*45
345-56
345+10656