結果
| 問題 | No.701 ひとりしりとり |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-06-15 22:44:01 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 140 ms / 2,000 ms |
| コード長 | 1,782 bytes |
| コンパイル時間 | 781 ms |
| コンパイル使用メモリ | 101,824 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-30 15:10:02 |
| 合計ジャッジ時間 | 1,664 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;
class Xorshift
{
private:
uint32_t x, y, z, w;
public:
Xorshift(uint32_t seed=88675123, int32_t loop=50){
x = 123456789;
y = 362436069;
z = 521288629;
w = seed;
while(--loop >= 0){
(*this)();
}
}
uint32_t operator()(){
uint32_t t=(x^(x<<11));
x=y; y=z; z=w;
return w=(w^(w>>19))^(t^(t>>8));
}
uint32_t operator()(uint32_t size){
return (*this)() % size;
}
uint64_t get64(){
uint64_t a = (*this)();
uint64_t b = (*this)();
return (a << 32) | b;
}
uint64_t get64(uint64_t size){
return get64() % size;
}
template <class T>
void shuffle(vector<T>& v){
uint32_t n = v.size();
for(uint32_t i=0; i<n-1; ++i){
uint32_t j = (*this)(n-i) + i;
swap(v[i], v[j]);
}
}
};
Xorshift xorshift(time(NULL));
const int LEN = 20;
int main()
{
int n;
cin >> n;
char prev = 'a';
for(int i=0; i<n; ++i){
string s(LEN, ' ');
s[0] = prev;
for(int j=1; j<LEN; ++j)
s[j] = 'a' + xorshift(26);
while((i == n - 1) ^ (s[LEN-1] == 'n'))
s[LEN-1] = 'a' + xorshift(26);
cout << s << endl;
prev = s[LEN-1];
}
return 0;
}