Submission #3020260
Source Code Expand
import java.util.*; import java.lang.*; // class Pair implements Comparable<Pair>{ // long a; // int cnt; // public Pair(long i, int j){ // this.a = i; // this.cnt = j; // } // public int compareTo(Pair p){ // if(this.cnt>=2 && p.cnt >=2 && this.a<p.a) return -1; // if(this.cnt<2 && p.cnt>=2) return -1; // return 1; // } // } class Main{ public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); int M = Integer.parseInt(sc.next()); if(Math.abs(N-M)>2)System.out.println(0); else{ long mod = (long)1e9+7; long r = kaijou(N)%mod * kaijou(M)%mod; if(N==M) System.out.println(2*r%mod); else System.out.println(r%mod); } } static long kaijou(long x){ long mod = (long)1e9+7; long res = 1; for(long i = 2; i<x+1; i++) res = res%mod*i%mod; return res%mod; } }
Submission Info
Submission Time | |
---|---|
Task | C - Reconciled? |
User | harunatsu |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 974 Byte |
Status | WA |
Exec Time | 99 ms |
Memory | 23764 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt, s3.txt, s4.txt |
All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, s1.txt, s2.txt, s3.txt, s4.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01.txt | AC | 89 ms | 18516 KB |
02.txt | AC | 99 ms | 19412 KB |
03.txt | AC | 90 ms | 21716 KB |
04.txt | AC | 97 ms | 19156 KB |
05.txt | AC | 96 ms | 20948 KB |
06.txt | AC | 90 ms | 19540 KB |
07.txt | WA | 96 ms | 18640 KB |
08.txt | AC | 89 ms | 19924 KB |
09.txt | AC | 97 ms | 19796 KB |
10.txt | AC | 95 ms | 18900 KB |
11.txt | AC | 90 ms | 19668 KB |
12.txt | AC | 89 ms | 19668 KB |
s1.txt | AC | 88 ms | 18516 KB |
s2.txt | AC | 88 ms | 23764 KB |
s3.txt | AC | 90 ms | 21588 KB |
s4.txt | AC | 98 ms | 19668 KB |