1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【APG4b AtCoder】ABC048 A - AtCoder *** Contest

Last updated at Posted at 2024-03-06

APG4b AtCoder 学習記録用 AtCoder***Contest

//AtCoder + "標準入力" + Contest
//標準入力の頭文字を取得

#include <bits/stdc++.h>
using namespace std;

int main(){
  string a,s,c;
  cin >> a >> s >> c;
  a = a.at(0);
  s = s.at(0);
  c = c.at(0);
  
  cout << a + s + c << endl;
}
  • string型の変数にchar型を入れているように見えるが、解いた後にgptに解説頼んだところ、char型を含むstringオブジェクトを変数に格納しているとのこと
  • 空文字変数を事前に定義しといて、for(int i = 0; i <1 ; i++)at(0)だけやって、この変数に格納してbreakするのも冗長かもしれないけどいいと思いました!
1
0
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?