stream

template<int P>
struct mod_int{
using Z=mod_int;
static int mo(int x){return x<0?x+P:x;}
int x;
int val()const{return x;}
mod_int():x(0){}
template<class T>mod_int(const T&x_):x(x_>=0&&x_<P?static_cast<int>(x_):mo(static_cast<int>(x_%P))){}
//...
friend istream& operator>>(istream&is,Z&x){long long y;is>>y;x=Z(y);return is;}
friend ostream& operator<<(ostream&os,const Z&x){return os<<x.val();}
};
const int P=119<<23|1;
using Z=mod_int<P>;
#include<bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(false);
ifstream fin("in.txt");
ofstream fout("out.txt");
fstream fio("io.txt");
fin.tie(&fout);
int x;
fin>>x; fout<<x;
fio>>x; fio<<x;
return 0;}
posted @   ShaoJia  阅读(33)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
点击右上角即可分享
微信分享提示