結果
| 問題 |
No.1185 完全な3の倍数
|
| コンテスト | |
| ユーザー |
fff
|
| 提出日時 | 2020-08-22 13:11:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 2,507 bytes |
| コンパイル時間 | 847 ms |
| コンパイル使用メモリ | 92,348 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 09:03:53 |
| 合計ジャッジ時間 | 1,902 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 39 |
ソースコード
#include<algorithm>
#include<bitset>
#include<iostream>
#include<iomanip>
#include<set>
#include<string>
#include<math.h>
#include<stack>
#include<string>
#include<queue>
#include<vector>
using namespace std;
typedef long long int ll;
typedef pair<int, ll> P;
//--------------
///#define DEBUG
//--------------
#ifdef DEBUG
#define debugprint(x) cout<<x<<" "
#define debugendl cout<<endl
#define debug(x) x
#else
#define debugprint(x)
#define debugendl
#define debug(x)
#endif
class zahyo{
public:
int x;
int y;
zahyo(){
x=0;
y=0;
}
zahyo(int x_,int y_){
x=x_;
y=y_;
}
void print(){
cout<<x<<" "<<y;
}
zahyo operator+(zahyo add){
add.x=this->x+add.x;
add.y=this->y+add.y;
return add;
}
zahyo operator-(zahyo add){
add.x=this->x-add.x;
add.y=this->y-add.y;
return add;
}
zahyo operator*(int t){
zahyo temp;
temp.x=this->x*t;
temp.y=this->y*t;
return temp;
}
zahyo operator%(int t){
zahyo temp(this->x%t,this->y%t);
return temp;
}
zahyo operator/(int t){
zahyo temp(this->x/t,this->y/t);
return temp;
}
bool operator==(const zahyo add) const{
if(add.x==this->x and add.y==this->y){return true;}
else{return false;}
}
bool operator!=(const zahyo add) const{
if(add.x==this->x or add.y==this->y){return false;}
else{return true;}
}
bool operator<(const zahyo add) const{
if(this->x<add.x){return true;}
else if(this->x==add.x and this->y<add.y){return true;}
else{return false;}
}
bool operator>(const zahyo add) const{
if(this->x>add.x){return true;}
else if(this->x==add.x and this->y>add.y){return true;}
else{return false;}
}
void input(){
cin>>x>>y;
}
};
int main(){
int n=0;
cin>>n;
//1+2
int ans=0;
int temp=0;
for(int i=1;i<=9;i++){
for(int j=0;j<=9;j++){
temp=i*10+j;
if(temp<=n and temp%3==0){
ans++;
}
}
}
for(int i0=0;i0<4;i0++){
for(int i1=0;i1<4;i1++){
for(int i2=0;i2<4;i2++){
for(int i3=0;i3<4;i3++){
for(int i4=0;i4<4;i4++){
for(int i5=0;i5<4;i5++){
for(int i6=0;i6<4;i6++){
for(int i7=0;i7<4;i7++){
for(int i8=0;i8<4;i8++){
temp=i0*pow(10,0)
+i1*pow(10,1)
+i2*pow(10,2)
+i3*pow(10,3)
+i4*pow(10,4)
+i5*pow(10,5)
+i6*pow(10,6)
+i7*pow(10,7)
+i8*pow(10,8);
temp=temp*3;
if(temp<=n and temp>100){
ans++;
}
}
}
}
}
}
}
}
}
}
cout<<ans<<endl;
}
fff