| #include< bits/stdc++.h > using namespace std; | |
| int main() | |
| { | |
| int tc; | |
| string s; | |
| scanf("%d ",&tc); | |
| while(tc--){ | |
| int ans = 0; | |
| getline(cin, s); | |
| stringstream line(s); | |
| string num; | |
| while (line >> num) { | |
| ans++; | |
| } | |
| cout << ans << endl; | |
| } | |
| return 0; | |
| } |
Sunday, September 22, 2019
প্রোগ্রামিং সমস্যা 7 - [৫২ সমস্যা বই] সংখ্যা গণনা
প্রোগ্রামিং সম6্যা 6 - [৫২ সমস্যা বই] যোগফল
| #include< iostream > using namespace std; | |
| int main() | |
| { | |
| int tc; | |
| string s; | |
| cin >> tc; | |
| while(tc--){ | |
| cin >> s; | |
| cout << "Sum = " << s[0]-'0' + s[4]-'0' << endl; | |
| } | |
| return 0; | |
| } |
প্রোগ্রামিং সমস্যা 5 - [৫২ সমস্যা বই] বাক্স-১
| #include< bits/stdc++.h > using namespace std; | |
| int main() { | |
| int tc,k; | |
| cin >> tc; | |
| for(int i = 1; i <= tc; i++) { | |
| cin >> k; | |
| for(int j = 1; j <= k; j++){ | |
| for(int p = 1; p <= k; p++){ | |
| cout <<"*"; | |
| } | |
| cout << endl; | |
| } | |
| if(i != tc) cout << endl; | |
| } | |
| return 0; | |
| } |
প্রোগ্রামিং সমস্যা 4 - [৫২ সমস্যা বই] ভাজক
| #include< iostream > using namespace std; | |
| int main() { | |
| int tc,k; | |
| cin >> tc; | |
| for(int i = 1; i <= tc; i++) { | |
| cin >> k; | |
| cout << "Case " << i << ": "; | |
| for(int j = 1; j <= k/2; j++){ | |
| if(k%j == 0) cout << j << " "; | |
| } | |
| cout << k << endl; | |
| } | |
| return 0; | |
| } |
প্রোগ্রামিং সমস্যা 3 - [৫২ সমস্যা বই] অধোগামী সংখ্যা
| #include< iostream > using namespace std; int main() | |
| { | |
| for(int i = 1000,j = 1; i > 0; i--, j++) { | |
| printf("%d\t",i); | |
| if(j == 5){ | |
| cout << endl; | |
| j = 0; | |
| } | |
| } | |
| return 0; | |
| } |
Saturday, September 21, 2019
প্রোগ্রামিং সমস্যা 2 - [৫২ সমস্যা বই] জোড়-বিজোড়-২
| #include< iostream > using namespace std; int main() { | |
| int tc; | |
| string s; | |
| cin >> tc; | |
| while(tc--) { | |
| cin >> s; | |
| cout << ((s[s.size()-1]%2)? "odd":"even") << endl; | |
| } | |
| return 0; | |
| } |
প্রোগ্রামিং সমস্যা 1 - [৫২ সমস্যা বই] জোড়-বিজোড়-১
| #include< iostream > | |
| using namespace std; | |
| int main() { | |
| int tc, num; | |
| cin >> tc; | |
| while(tc--){ | |
| cin >> num; | |
| cout << ((num&1)?"odd":"even") << endl; | |
| } | |
| return 0; | |
| } |
Monday, September 16, 2019
Codeforce A. DZY Loves Chessboard
- #include< bits/stdc++.h >
- using namespace std;
- int main(){
- int n, m, b = 0, w = 0;
- cin >> n >> m;
- char data[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- cin >> data[i][j];
- }
- }
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- if(data[i][j] == '.') {
- if((i+j) % 2) cout << 'W';
- else cout << 'B';
- }else cout << data[i][j];
- }
- cout << endl;
- }
- return 0;
- }
Subscribe to:
Posts (Atom)