fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int p;
  6. string text;
  7. int price;
  8. cin >> p;
  9.  
  10. // パターン1
  11. if (p == 1) {
  12.  
  13. cin >> price;
  14. }
  15.  
  16. // パターン2
  17. if (p == 2) {
  18.  
  19. cin >> text >> price;
  20. }
  21.  
  22. int N;
  23. cin >> N;
  24.  
  25. cout << text << "!" << endl;
  26. cout << price * N << endl;
  27. }
  28.  
Success #stdin #stdout 0.01s 5292KB
stdin
1
80
5
stdout
!
400